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
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