Error -2146697208 in a send call (MSXML2.XMLHTTP60)

Jean-Louis Sourrouille 0 Reputation points
2024-03-09T13:48:19.8566667+00:00

Hi! From about 2 months an intermittent error appears when I send a request using MSXML2.XMLHTTP60 in a VBA-excel program. I have a similar issue with VB-Visual studio (error "53" - The file was not found - and when I retry "System.IO.FileNotFoundException HResult=0x800C0008")

The heart of the sequence is simple:

...

ActiveWorkbook.FollowHyperlink (urlRequest) ' to verify the request, always ok

Set xmlhttp = New MSXML2.XMLHTTP60

xmlhttp.Open "GET", urlRequest, False ' asynchronous call

xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"

xmlhttp.send ' retry if error

...

When the last line (send) triggers an "Err.Number = -2146697208" (URLDownloadToCacheFile ?), I catch it and retry the sequence. Then VBA proposes me to switch in debug mode or stop, while in VB the program aborts. In VBA, manually, I redo this sequence until it is accepted not to abort in a bad place.

When a call successes, as long as the following calls are close together, the error doesn't appear. But after a few minutes without request it will occur again.

All my applications run as usual, except Lightroom that uses the same API (Flickr): I should now try several times to access to the API. You might think that the API is the cause, but the same request in firefox always give the result without error. Moreover, if the API was wrong VBA would catch the error, not abort. We can only think that the behavior of the Flickr API is questionable.

I have re-installed windows 11 (pro) plus excel and checked in this basic configuration without firewall. I have tried with wired network and WiFi, I have removed energy saving and multi-thread in excel, I have used WinHTTP and ServerXMLHTTP60, I have checked on an other computer with Windows 10. The error always occurs.

 I have checked my hardware with the manufacturer tools. I have installed an old USB adapter (Linksys WUSB6100M). The issue has disappeared for a few days but unfortunately it appears again with a difference: the error number is -2146697211 (The system cannot locate the resource specified) and there is a long wait before the send triggers the error. Anyway, there are very less errors with this adapter. Why?

It seems that the "send" does not wait the reply while the call is synchronous. If I send an asynchronous call, I get a different error number (-2147483638: "The data necessary to complete this operation is not yet available"), but when I retry the result is very often ok, why? Is there a cache issue ?

Thanks to read this long question! Somebody has an idea ?

Microsoft 365 and Office | Development | Other
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.