When I'm trying to download an empty file with this script, I get the error: Arguments are of the wrong type, are out of acceptable range or are in conflict with one another. How can I fix it?
Here is my script
Set objHTTP = CreateObject("WinHTTP.WinHttpRequest.5.1")
objHTTP.Open "GET", "http://localhost/file.txt", False
objHTTP.Send
Dim objStream
Set objStream = CreateObject("ADODB.Stream")
With objStream
.Type = 1
.Open
.Write objHTTP.ResponseBody
.SaveToFile "C:\file.txt"
.Close
End With
Set objStream = Nothing
I have this problem only with empty files.