I spent a lot of time trying to find a way to do this and, after giving up, I stumbled on the solution while looking for something else...
Here it is:
'***** Begin of Code *******
'***
'***
'*** Call: a = Fetch("'***
'*** return TRUE on success
'***
Public Function Fetch(url, dest)
On Error Resume Next
Err.Clear
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", url, False
.send
b = .responseBody
If Err.Number <> 0 Or .Status <> 200 Then
Fetch = False
Exit Function
End If
End With
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.write b
.savetofile dest, 2
End With
Fetch = Err.Number = 0
End Function
'****** end of code *****
I hope it helps you as much as it helped me!
Eric
Here it is:
'***** Begin of Code *******
'***
'***
'*** Call: a = Fetch("'***
'*** return TRUE on success
'***
Public Function Fetch(url, dest)
On Error Resume Next
Err.Clear
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", url, False
.send
b = .responseBody
If Err.Number <> 0 Or .Status <> 200 Then
Fetch = False
Exit Function
End If
End With
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.write b
.savetofile dest, 2
End With
Fetch = Err.Number = 0
End Function
'****** end of code *****
I hope it helps you as much as it helped me!
Eric