I've found umpteen examples of code to download files from the Internet, none of which I can get to work in Excel 2013. I'm trying to get the basic functionality working before I expand my code to do the other things I want to do, so below is the simplest version of code I could find which I thought should work. At the following line
Set objStream = CreateObject(“ADODB.Stream”)
I get an error message "Object required." I must be doing something simple wrong. Can anyone point me in the direction of my error?
TIA,
Nolan
<code>
Sub testDownload()
Dim objStream As Object
Dim xHttp As MSXML2.XMLHttp
Set xHttp = New MSXML2.XMLHttp
xHttp.Open "GET", "http://www.xxxxx.wmv", False
xHttp.send
Set objStream = CreateObject(“ADODB.Stream”)
objStream.Type = 1
objStream.Open
objStream.Write xHttp.responseBody
objStream.SavetoFile "I:\xxxxx.wmv", 2
objStream.Close
End Sub
</code>
Set objStream = CreateObject(“ADODB.Stream”)
I get an error message "Object required." I must be doing something simple wrong. Can anyone point me in the direction of my error?
TIA,
Nolan
<code>
Sub testDownload()
Dim objStream As Object
Dim xHttp As MSXML2.XMLHttp
Set xHttp = New MSXML2.XMLHttp
xHttp.Open "GET", "http://www.xxxxx.wmv", False
xHttp.send
Set objStream = CreateObject(“ADODB.Stream”)
objStream.Type = 1
objStream.Open
objStream.Write xHttp.responseBody
objStream.SavetoFile "I:\xxxxx.wmv", 2
objStream.Close
End Sub
</code>