The following used to work. Now it cannot find the file and WinHttpReq.status = 404.
Code:
On Error GoTo Failed
Dim oStream As Variant
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("MSXML2.ServerXMLHTTP.6.0")
WinHttpReq.Open "GET", FileURL, False, Username, Password
WinHttpReq.send
If WinHttpReq.status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
Dim OWrite As Integer
If DontOverWrite = True Then
OWrite = 1
Else
OWrite = 2
End If
oStream.SaveToFile LocalFolderFile, OWrite
oStream.Close
Exit Sub
End If
Failed:
Debug.Print "Failed to DL " & URLStr