P
Paul Martin
Hi guys
I need to download files from a static URL and am using the following
code from http://officeone.mvps.org/vba/http_download_file.html:
Sub HTTPDownloadFile(ByVal URL As String, _
ByVal LocalFileName As String)
Dim HTTP As Inet
Dim Contents() As Byte
Set HTTP = New Inet ' <<<< CODE FAILS HERE
With HTTP
.Protocol = icHTTP
.URL = URL
Contents() = .OpenURL(.URL, icByteArray)
End With
Set HTTP = Nothing
Open LocalFileName For Binary Access Write As #1
Put #1, , Contents()
Close #1
End Sub
The code works on some machines but not others, failing at "Set HTTP =
New Inet".
The error message is:
"Run-time error '429':
ActiveX component can't create object".
I can't detect any reason why the code works on one machine and not
the other, as they are allegedly built from the same profile (both
running WinXP, Office2003). Both machines have MSINET.OCX, same
version (6).
I'm thinking maybe it's a registry entry, but hopefully someone on
here has come across this and has a solution?
TIA
Paul Martin
Melbourne, Australia
I need to download files from a static URL and am using the following
code from http://officeone.mvps.org/vba/http_download_file.html:
Sub HTTPDownloadFile(ByVal URL As String, _
ByVal LocalFileName As String)
Dim HTTP As Inet
Dim Contents() As Byte
Set HTTP = New Inet ' <<<< CODE FAILS HERE
With HTTP
.Protocol = icHTTP
.URL = URL
Contents() = .OpenURL(.URL, icByteArray)
End With
Set HTTP = Nothing
Open LocalFileName For Binary Access Write As #1
Put #1, , Contents()
Close #1
End Sub
The code works on some machines but not others, failing at "Set HTTP =
New Inet".
The error message is:
"Run-time error '429':
ActiveX component can't create object".
I can't detect any reason why the code works on one machine and not
the other, as they are allegedly built from the same profile (both
running WinXP, Office2003). Both machines have MSINET.OCX, same
version (6).
I'm thinking maybe it's a registry entry, but hopefully someone on
here has come across this and has a solution?
TIA
Paul Martin
Melbourne, Australia