Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use Shell to download file from web

Status
Not open for further replies.

waytech2003

Programmer
Jul 14, 2003
316
US
I know this has been discussed before, but I can not seem to get this to work. I want to download a text file from a sub-directory on a website. I have sample code below.

Code:
Private Sub Command1_Click()
   Dim Reply As Variant
   Dim ftpFolder As Folder: Dim ftpShell As Shell: Set ftpShell = New Shell
   Dim localFolder As Folder: Dim localShell As Shell: Set localShell = New Shell
   
   Set localFolder = localShell.NameSpace("C:\")
   Reply = localFolder.Items.Count'This gives me a good count number

   Set ftpFolder = ftpShell.NameSpace("ftp://myUsername:myPassword@myWebsite.com/SubDir1/SubDir2/")
   Reply = ftpFolder.Items.Count 'This returns ZERO
   
   localFolder.CopyHere ftpFolder.Items.Item("textfile.txt")
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top