ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Ftp From Excel (https://www.excelbanter.com/excel-programming/306029-ftp-excel.html)

GJones

Ftp From Excel
 
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

Tetsuya Oguma[_4_]

Ftp From Excel
 
Hi,

How about using Shell command like this?

Shell "ftp -s: myfile myserver", vbHide

Cheers,

"GJones" wrote:

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


Tetsuya Oguma[_4_]

Ftp From Excel
 
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,
---
Tetsuys Oguma, Sydney, Australia

"Tetsuya Oguma" wrote:

Hi,

How about using Shell command like this?

Shell "ftp -s: myfile myserver", vbHide

Cheers,

"GJones" wrote:

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


Tetsuya Oguma[_4_]

Ftp From Excel
 
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!

"Tetsuya Oguma" wrote:

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,
---
Tetsuys Oguma, Sydney, Australia

"Tetsuya Oguma" wrote:

Hi,

How about using Shell command like this?

Shell "ftp -s: myfile myserver", vbHide

Cheers,

"GJones" wrote:

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



All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com