I'm working on a project where I need to download files from an FTP site for processing. Ideally, I'd like to get a list of the files into an array first, then skip over the files that begin with "AB" - but that would be a grace note.

The crux of my problem is the download portion.

I've been trying to use this code (set up to test code only), but keep getting a "Run-time error '429' ActiveX component can't create object" error.

[vba]
Sub ftptest()
Dim DidIGetIt As Boolean
DownloadFile "ftp://aValidFTPsite", "username", "password", _
"I want my sample file.txt", _
"C:\Temp\DOWNLOADED SampleFile.txt"
MsgBox DidIGetIt
End Sub

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


Dim FTP as Inet
Set FTP = New Inet
With FTP
.Protocol = icFTP
.RemoteHost = HostName
.UserName = UserName
.Password = Password
.Execute .URL, "Get " + RemoteFileName + " " + LocalFileName
Do While .StillExecuting
DoEvents
Loop
DownloadFile = (.ResponseCode = 0)
End With
Set FTP = Nothing
End Function
[/vba]

I've got my references to Microsoft Internet Transfer Control 6.0 and ActiveX plugin set up, and no matter what I do, same problem.


Suggestions? Anyone? Beuhler? Beuhler?

PS: for some reason the VBA formatting thingie thinks its funny to stick colour references in lines 5 & 7 of the function, and muck about with the indents. Edit as needed, sorry & thanks.