XMLHTTP: system cannot locate the resource specified

iknowu99

Well-known Member
Joined
Dec 26, 2004
Messages
1,158
Office Version
  1. 2016
hello all,

i am getting the error
run-time error '-2146697211 *800c0005)'':
the system cannot locate the resource specified

when running the following:
my guess is because sometimes the internet connection doesnt always work, or the page loads too slow, but 'on error resume next' doesnt work because the line takes awhile to execute and then excel turns off:(

i believe i saw somewhere here (mrexcel) how to give specific commands a limited time to run. i dont rememeber how to do this though, or any other workaround >> help is appreciated:)


Code:
Sub foobar()
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
strURL = "http://www.yahoo.com"
xmlhttp.Open "GET", strURL, False, "", ""
xmlhttp.Send 'freezes here often
RtnPage = xmlhttp.ResponseText

Set fs = CreateObject("Scripting.FileSystemObject")
Set ag = fs.CreateTextFile("C:\test.html", True)
ag.Writeline (RtnPage)
ag.Close
End Sub
 
The latest code seems to be working yet still i have no answer for:

Code:
still not sure whether this while/wend loop helps timeouts since it is after the freeze/timeout problem of 'xmlhttp.Send'

maybe some gurus care to comment?
:)
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,221,483
Messages
6,160,100
Members
451,618
Latest member
Gangadhar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top