Solved

excel VBA FTP

Posted on 2011-09-07
3
288 Views
Last Modified: 2012-05-12
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
Comment
Question by:sandramac
3 Comments
 
LVL 15

Expert Comment

by:Minh Võ Công
ID: 36500521
Do you want download or upload file?
0
 

Author Comment

by:sandramac
ID: 36500730
Looking to upload
0
 
LVL 16

Accepted Solution

by:
AlexPace earned 500 total points
ID: 36504204
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now