msinet.ocx 429 error


I want to do an ftp from within Excel.
I have selected 'Microsoft Internet Transfer Control 6.0 (SP4)'
under Tools->References.

Below is the code.  I get stuck on the line
'Set ftp = New Inet' with error message...

Runtime error '429'
Acitvex component can't create object

Please help,
Function UploadFile(ByVal HostName As String, _
    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
        UploadFile = (.ResponseCode = 0)
    End With
    Set ftp = Nothing
End Function
Who is Participating?
Are you properly licensed to use that control on your machine?  I believe you must have VB6 installed to use this control in the development environment.
bezalelyAuthor Commented:
I don't have VB6 installed on my computer, but the file was already present on my PC.
In that case is there any other way to FTP using Excel's VBA???
There are a lot of FTP components out there for use in VB / VBA and the prices vary.  

There are also some free examples of how to use the Windows API within your program to do simple FTP transfers.  Here are a couple of free code listings so that you can make your own FTP class module in VBA.  I have not personally used them so I can't say how well they work - but they are free.

FTP Class based on the FileSystemObject using the Wininet Library

Put basic FTP functionality in your VB applications
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.