Extending the time-out duration for loading URLs in Excel?

K

Ker_01

Friends-

Using XL2003 on WinXP. The workbook is local, the URLs are corporate
intranet (in a different state). Searched with Google, but she showed me no
love.

Using the code below, I am cycling through a large number of pages
(thousands) on our corporate intranet. Unfortunately, I keep getting the
error:
[Run-time error '-2147012894(80072ee2)' The operation timed out] part way
through my looping after seemingly random numbers of URLs (as far as I can
tell, it changes each time) so I'm assuming the problem isn't the code or
the URL, but my ability to maintain a good connection with the server.

If AllPages(ProcessRegEx) <> "" Then
Application.StatusBar = ProcessRegEx & " of " & UsedAllPages
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = AllPages(ProcessRegEx)
objHTTP.Open "GET", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("") '<<< where it dies
SourceHTMLText = objHTTP.responseText

Is there a way to either force the timeout to be longer, or keep retrying
until it gets the page? Alternatively I might explore using On Error Resume
Next, then just come back and try to manually re-run the ones that are
missing...but I'd rather automate it completely in case I have to hand this
off to someone else to run in the future.

Thanks!
Keith
 
K

Ker_01

Worked beautifully Tim- thank you. I set all durations to unlimited, and
while it still took a few hours for the workbook to chug through the 1000+
URLs, it didn't stall. Woot!
Keith

Tim Williams said:
http://msdn2.microsoft.com/en-us/library/ms760403.aspx

Tim

Ker_01 said:
Friends-

Using XL2003 on WinXP. The workbook is local, the URLs are corporate
intranet (in a different state). Searched with Google, but she showed me
no love.

Using the code below, I am cycling through a large number of pages
(thousands) on our corporate intranet. Unfortunately, I keep getting the
error:
[Run-time error '-2147012894(80072ee2)' The operation timed out] part way
through my looping after seemingly random numbers of URLs (as far as I
can tell, it changes each time) so I'm assuming the problem isn't the
code or the URL, but my ability to maintain a good connection with the
server.

If AllPages(ProcessRegEx) <> "" Then
Application.StatusBar = ProcessRegEx & " of " & UsedAllPages
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = AllPages(ProcessRegEx)
objHTTP.Open "GET", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("") '<<< where it dies
SourceHTMLText = objHTTP.responseText

Is there a way to either force the timeout to be longer, or keep retrying
until it gets the page? Alternatively I might explore using On Error
Resume Next, then just come back and try to manually re-run the ones that
are missing...but I'd rather automate it completely in case I have to
hand this off to someone else to run in the future.

Thanks!
Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top