can I pull data from FTP server?

demodren

Board Regular
Joined
Aug 20, 2010
Messages
106
Hi all, would anyone be able to perhaps point me in the right direction.
I run current macros which pull specific data from a shared drive. I want to see if I can now pull the same data from ftp server(I have address,user id,pw) Is it possible to incorporate this in the code I currently have? Any other options?

Any help would be greatly appreciated

Thanks so much


Code:
Dim strConn As String
    Dim objConn As Object
    Dim rst As Object
    Set objConn = CreateObject("ADODB.Connection")
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=C:\data.xls;" & _   
              "Extended Properties=""Excel 8.0;HDR=YES"""
    objConn.Open strConn
    Set rst = CreateObject("ADODB.Recordset")
    rst.Open "SELECT * FROM [data$] WHERE [level_id] = '2';", objConn
 
    Sheets("Main").Select
    Rows("2:2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents
 
thanks Xenou.. I am little lost within those threads..

So just to understand it.. the way to have VBA download the file is a 2 step process:

1) write test.BAT file..for example, I need to download 3 files so I wrote:

Code:
ftp
Open ftp.myfiles.net
User ID PW
cd files
get file 1
get file 2
get file 3
bye
2) and then call it with RetVal = Shell("H:\test.BAT", 1)

however, it just runs the command but nothing happens.. Am I missing something here?
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,216,075
Messages
6,128,667
Members
449,462
Latest member
Chislobog

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