Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP / INET FOLDER SEARCH

Status
Not open for further replies.

msstrang

Programmer
Sep 19, 2005
62
US
i am a pretty good user in vba, but have never used it to work with an FTP folder, and i am having much trouble finding any help in the way of sample code.
so far i am using the following code i found online to upload a file just so i can get a grip of using an FTP with VBA. However when i run the code i get the following error:

"429 ActiveX component can't create object" at the line of code that states "Set FTP = New inet"

i've got the "MSINET.OSX" file selected in my references...
any help would be great.



Option Explicit

Function UploadFile()

Dim HostName As String
Dim UserName As String
Dim Password As String
Dim LocalFileName As String
Dim RemoteFileName As String

HostName = "my ftp site"
UserName = "my username"
Password = "my password"
LocalFileName = "my file name"
RemoteFileName = "my file name"

Dim FTP As inet

Set FTP = New inet


With FTP
.Protocol = icFTP
.RemoteHost = HostName
.UserName = UserName
.Password = Password
.Execute .URL, "Put " + LocalFileName + " " + RemoteFileName
Do While .StillExecuting
DoEvents
Loop
UploadFile = (.ResponseCode = 0)
End With
Set FTP = Nothing
End Function

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top