Macro to download FTP File
I have an excel workbook and need to import a file for eg East Vat Account.xls residing on an FTP site.I have written code to do this, but get a message "invalid code" at the user name and login. However, when running the script from a.bat file , it downloads into a directory called downloads perfectly. It would be appreciated if you could assist
My script is as follows:
open 18.2.14.196 (fictitious FTP)
user dave (fictitious)
password pass (fictitious)
bin
hash
lcd c:\downloads
** east
mget East Vat*.xls
quit
My VBA code is
Public Sub Ftp_Download_File()
Dim FTPcommand As String
Dim wsh As Object
FTPcommand = "ftp -n -s:" & Chr(34) & "C:\FTP_commands.txt" & Chr(34)
Set wsh = CreateObject("WScript.Shell")
wsh.Run FTPcommand, 5, True
End Sub
|