- Select Tools | References....
- Select Microsoft Internet Transfer Control from the available references.
- If it is not available, click the Browse... button. You will be presented with the Add Reference dialog box.
- Locate and select MSINET.OCX. This file is usually present in the System folder.
- Click Open to dismiss the Add Reference dialog box.
- Click OK.
ByVal UserName As String, _
ByVal Password As String, _
ByVal LocalFileName As String, _
ByVal RemoteFileName As String) As Boolean
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