Save to FTP

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
 
S

shockley

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top