![]() |
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 |
All times are GMT +1. The time now is 05:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com