Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Download file to computer from FTP

Hello-

I found the following code to download a csv file from an FTP site,
but I am getting an error message in VB that I don't understand. The
code is below:

Sub FTPCheck()
Const cHost = "ftp://XX.XX.XX.XXX/VERPNDDIV.csv"
Const cUserName = "MyUserName"
Const cPW = "MyPassword"
Dim strData As String
Dim strTempFile As String


strData = "VERPNDDIV.csv"
strTempFile = "C:\" & strData

MsgBox DownloadFile(cHost, cUserName, cPW, strData, strTempFile)

End Sub


Function DownloadFile(ByVal HostName As String, _
ByVal UserName As String, _
ByVal Password As String, _
ByVal RemoteFileName As String, _
ByVal LocalFileName As String)

Dim FTP As InetCtlsObjects.Inet <----This is the line that is
highlighting as an error
Set FTP = New InetCtlsObjects.Inet
With FTP
.URL = HostName
.Protocol = 2
.UserName = UserName
.Password = Password
.Execute , "Get " + RemoteFileName + " " + LocalFileName
Do While .StillExecuting
DoEvents
Loop
DownloadFile = (.ResponseCode = 0)
End With
Set FTP = Nothing
End Function

Does anyone have any ideas? Or know of a simple way to pull a csv file
from an FTP site using code? Any help would be appreciated.

Thanks-

Scott
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What program do I need to download clip art onto my computer? Ashley-T Excel Discussion (Misc queries) 1 September 16th 07 07:40 PM
How do I download it on my computer decktop? Carleisha Setting up and Configuration of Excel 1 June 4th 07 02:50 AM
How do I re-download Excel onto my computer (it crashed)? sueb262 Excel Discussion (Misc queries) 3 November 26th 05 07:55 AM
How do I download Excel to my computer after installing XP Dave D New Users to Excel 2 May 2nd 05 12:07 AM
How 2 get partial office download out of computer-do NOT have off. lunasatic Excel Discussion (Misc queries) 0 March 23rd 05 08:45 PM


All times are GMT +1. The time now is 05:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"