randomhouse
11-15-2008, 04:35 AM
Hi,
I need to connect to an FTP server and download a file from a specified location. I wrote some VBA code which unfortunately does not work. But it generates a script file - which if I copy into ftp .exe, it works.
Your help will be appreciated. Thanks!
Nitin
PS: Here's my code.
Sub Macro1()
fNum = FreeFile()
Open ThisWorkbook.Path & "\FtpComm.txt" For Output As #fNum
Print #1, "open ftp .site .com" '' I've added spaces here coz it doesnt let me post links
Print #1, "usename"
Print #1, "password"
Print #1, "recv triala" ' close connection
Print #1, "bye" ' Quit ftp program
Close #1
Shell "ftp -s:" & ThisWorkbook.Path & "\FtpComm.txt ", vbNormalNoFocus
'Shell "ftp -n -i -g -s:" & file & vFTPServ, vbNormalNoFocus
End Sub
I need to connect to an FTP server and download a file from a specified location. I wrote some VBA code which unfortunately does not work. But it generates a script file - which if I copy into ftp .exe, it works.
Your help will be appreciated. Thanks!
Nitin
PS: Here's my code.
Sub Macro1()
fNum = FreeFile()
Open ThisWorkbook.Path & "\FtpComm.txt" For Output As #fNum
Print #1, "open ftp .site .com" '' I've added spaces here coz it doesnt let me post links
Print #1, "usename"
Print #1, "password"
Print #1, "recv triala" ' close connection
Print #1, "bye" ' Quit ftp program
Close #1
Shell "ftp -s:" & ThisWorkbook.Path & "\FtpComm.txt ", vbNormalNoFocus
'Shell "ftp -n -i -g -s:" & file & vFTPServ, vbNormalNoFocus
End Sub