Execute FTP Commands with VBA

mchac

Well-known Member
Joined
Apr 15, 2013
Messages
531
I have FileZilla installed and would like to pass commands to it from VBA.
This site: How to Execute FTP Commands With VBA | eHow.com
has some instructions on how to accomplish this but the last instruction says to add the following to VBA code which executes a batch file which then executes an FTP Command File:

Shell ("doFtp.bat"), vbHide '', vbMinimizedNoFocus

It goes on to say that the line contains two single quotes, without any character between them, immediately before the second comma. However this will only create a comment after the first single quote so the rest of the line is ignored.

Does anyone have an alternative command or methodology to execute FTP via VBA?
 
sweet indeed. absolutly awesome.
My path was wrong. I didn't realize you could skip the Archives part of the path.

This is not only easier but I think it's faster than the batch file to txt file to ftp software route.

Thank you very much!
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
sweet indeed. absolutly awesome.
My path was wrong. I didn't realize you could skip the Archives part of the path.

I got the path by logging into the server as well as using the path you gave. I didn't see an Archives directory, but did see the Edgar directory, so just worked back from there.

Sometimes it is just a matter of getting the question in front of the right brain. :)

Maybe John could answer this one.

Lets say it isn't an anonymous ftp server. How would one pass the login and password.

I tried this....

DownloadFile "ftp://myusername@ftp.nelacat.com/rjfiles.nelacat.com/bmx/peixebike!.jpg", "C:\rj\excel\peixebike!.jpg"

but without the password it does nothing. it's just a picture of my bike. I just wanted to see if it would work, which gave me an idea of automating some of the website logs I monitor. (Personal related, not business related)
 
Upvote 0
Answered my own question just as soon as I hit send. It's the same as passing the username and password in url in the browser, so would be like this....

DownloadFile "ftp://myusername:mypassword@ftp.nelacat.com/rjfiles.nelacat.com/bmx/peixebike!.jpg", "C:\rj\excel\peixebike!.jpg"

Edit: As a side note. the web address is like this. www.rjfiles.nelacat.com/bmx/peixebike!.jpg which further illustrates how ftp directory structures and web url structures can be different.
 
Last edited:
Upvote 0
well, it does work for me. however direct download the way John suggested and rj commented on above has fewer moving parts.
 
Upvote 0
I know this is an old thread, but I've been looking for something like this for days. Tried many other approaches. None worked despite hours of effort. This worked within 5 minutes! Thank you RJ and mchac.

Is there something similar to upload a file to a site?

Many thanks for any assistance you can provide.
 
Upvote 0
i don't know though a quick search doesn't show any similar command to URLDownloadToFile. suggest you start a new post asking about this.
 
Upvote 0

Forum statistics

Threads
1,223,636
Messages
6,173,483
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top