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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP using VBA and Windows Explorer & File System Object

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I need to upload several documents every week to our WEB site. using Joomla is trying at best. So I thought I would use FTP. I also don't want to buy an FTP program.
I managed to open Windows Explorer and login to the WEB site and get to the correct folder. I can drag and drop the files in question from our Server to the FTP explorer window at that point but would like to schedule this as a task and let it run automatically. Specifically the error is ( I think anyway) with the ftp://ourWEBsite.com/etc/andso_on/ in the second part of the fso.CopyFile shown in red below. Error is "folder not found".
Code:
    Dim OpenFolder, OpenFolder2 As String

    OpenFolder = "ftp://login:password@ourWEBsite.com/etc/andso_on/"
       
    retval = Shell("explorer.exe " & OpenFolder, vbNormalFocus)
    '----------- Note requires Tools|references and check the Microsoft Scripting Runtime
    Dim fso As New FileSystemObject
    fso.CopyFile "S:\IT\announcements\file_to_upload.txt", [COLOR=red]"ftp://ourWEBsite.com/etc/andso_on/"[/color]
Any ideas?
maybe get the handle of the Explorer window and pass a file to it?

TIA



DougP
 
Why not simply launch an 'ftp -s' command ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top