Ftp From Excel

G

GJones

Could you tell me how to do a Ftp from VBA in Excel. I
need to pass the user name and password so I will not be
prompted.

Thanks,

Greg
 
G

Guest

Hi,

How about using Shell command like this?

Shell "ftp -s: myfile myserver", vbHide

Cheers,
 
G

Guest

Oooops,

I forgot to tell you important bit.

Typically we create a file that includes parameters being passed to FTP
command. So, first create a text file and pass that as parameter of FTP
command, something like:

Dim l_fso As Scripting.FileSystemObject
Dim l_ts As Scripting.TextStream
dim szCommandText as String
szCommandText = "C:\my_command_text.txt"

Set l_fso = New Scripting.FileSystemObject
Set l_ts = fso.CreateTextFile(szCommandText, True)
l_ts.WriteLine ("ftp")
l_ts.WriteLine ("ftp")
l_ts.WriteLine ("cd /mydir")
l_ts.WriteLine ("put my_ftp_file")
l_ts.WriteLine ("quit")
l_ts.Close

Shell "ftp -s:" & szCommandText & " my.server.com ", vbHide

Cheers,
 
G

Guest

Hi again,

The first line of text being username and the second password.
l_ts.WriteLine ("ftp") <- username
l_ts.WriteLine ("ftp") <- password

Sorry for pestering you!
 

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