Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using FTP Download in VBA Code

33 views
Skip to first unread message

Steve Lang

unread,
Jul 29, 2004, 12:20:04 PM7/29/04
to
Hi all,

I am trying to use the minet.ocx to automatically download a file on a FTP
site. I downloaded the code snippet from the MVPS.org website and set it all
up. I must be doing something wrong, since the file never transfers but I
don't get an error message! I can manually drag and drop the file so I know
I have access to the FTP site.
Below is the code. Any help is appreciated.

^^^^^^^^^^^^^^^^START CODE
Sub FTPCheck()
Const cHost = "www.leg.state.nv.us"
Const cUserName = ""
Const cPW = ""
Dim strData As String
Dim strTempFile As String

strData = "Test Document.doc"
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) 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

^^^^^^^^^^^^^^^^^^^^^^^^ END CODE
TIA and have a great day!

Steve


Steve Lang

unread,
Jul 29, 2004, 1:47:36 PM7/29/04
to
Hi all,

I figured out the problem. The web dudes gave me the wrong FTP address. No
problems, once it is the correct place to go!

Steve

"Steve Lang" <now...@Nohow.not> wrote in message
news:uoMGpfYd...@tk2msftngp13.phx.gbl...

Steve Lang

unread,
Jul 29, 2004, 4:14:30 PM7/29/04
to
I got it to work on one machine, but on three others I get an error on the
line:

Set FTP = New Inet

The error is "429: ActiveX cannot create object"

I have the references loaded on the user's computer, and I copied and
registered the msinet.ocx as well. Anyone have any ideas as to what to look
for now?

TIA and have a great day!

Steve


"Steve Lang" <now...@Nohow.not> wrote in message

news:OBMXjQZd...@tk2msftngp13.phx.gbl...

0 new messages