• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

excel VBA FTP

Hello all,  trying to see if this is possible and can be encoded.  After the last line in my vba code to transfer the in C:\Users\data\mysummary.pdf, C:\Users\data\mysummary.html, and C:\Users\data\filelist.html to my webserver via FTP.  I have my username and password to my FTP, just looking on a way to do this.  Thanks.
0
sandramac
Asked:
sandramac
1 Solution
 
Minh Võ CôngCommented:
Do you want download or upload file?
0
 
sandramacAuthor Commented:
Looking to upload
0
 
AlexPaceCommented:
You could write a Robo-FTP script to upload files with these names to the remote site.  You can use the -s command line switch when you launch Robo-FTP so it automatically runs your script.  If you don't know the exact name of the files before your process runs, you could pass them on the command line also using the -p1 -p2 and -p3 arguments as described in this excerpt from the help file:
-pX arg    Define Shortcut Target argument
Use of the -pX switch is the preferred method to pass external arguments into Robo-FTP from a shortcut or the Windows Command Prompt command line. The value X must be the single digit 1 - 9. Therefore, up to nine arguments may be passed this way and are assigned to internally defined script file variables %1 through %9. The single space between X and arg is required.

The advantage to this method over the legacy method (see below) is that Windows environment variables (e.g.,  %SystemDrive%, %USERNAME%, etc.) as well as user defined strings may be passed into Robo-FTP. Consider this example where the name of a file to process is passed on the command line:
    C:\program files\robo-ftp 3.7\robo-ftp.exe -p1 FridaySales.xls

The values could then be used by Robo-FTP as follows:
    SENDFILE %1

... or you could invoke Robo-FTP using COM instead of running it as an external executable.  This allows control to remain inside of your VBA function and you could just feed Robo-FTP commands one at a time.  Here is an example showing how to do that as a VBScript so it should be fairly easy to convert to VBA:  http://www.robo-ftp.com/help/3.7/sample_vbscript.htm
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now