Save to FTP

  • Thread starter Thread starter cogent
  • Start date Start date
C

cogent

Hello

I am trying to automate a save to my ftp site, but there does not seem to be
a way to do it without user intervention. Using the following code, I still
get a dialog box asking for user (required) and password:

Sub SaveFTP()
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileName:= _
"ftp://208.37.158.126/home/data/myfile.csv", FileFormat:= _
xlCSV, Password:="juicy122", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
End Sub

Any ideas?

W
 
The password you are using with the SaveAs method is for opening the
workbook you are saving, not for accessing the ftp server. One way to
automate this upload would be to write a dos batch script using ftp
commands. You can get help on these commands here:
http://www.computerhope.com/software/ftp.htm#04

As an example script here's one I wrote for uploading the file "SP.xls" to
my ftp server:

open ftp.frontiernet.net
user shockley 'username
mypet 'password
cd public_html 'the directory on the server containing my files
binary
put SP.xls
quit

Save the script as a .bat file and call it using the Shell command, eg.,

Shell ("G:\Batch\ftp00.bat")

HTH,
Shockley
 
Back
Top