KenCriss
Active Member
- Joined
- Jun 6, 2005
- Messages
- 326
Found this piece of code which works well for downloading files from the web but am wondering if anyone know the return values...
I have tried calling it like this
...but if it fails, it does not necessarily come back with a False like I thought it would.
Any thoughts?
Code:
Function SaveWebFile(ByVal vWebFile As String, ByVal vLocalFile As String) As Boolean
Dim oXMLHTTP As Object, i As Long, vFF As Long, oResp() As Byte
Set oXMLHTTP = CreateObject("msxml2.xmlhttp")
oXMLHTTP.Open "GET", vWebFile, False
oXMLHTTP.send
oResp = oXMLHTTP.ResponseBody
vFF = FreeFile
If Dir(vLocalFile) <> "" Then Kill vLocalFile
Open vLocalFile For Binary As #vFF
Put #vFF, , oResp
Close #vFF
Set oXMLHTTP = Nothing
End Function
I have tried calling it like this
Code:
If (SaveWebFile "https://xxxxxxx.com/whatever.zip", ThePath & "\PUpdate.zip") = True
Any thoughts?