Web queries still hanging

ourmick

New Member
Joined
Mar 17, 2009
Messages
35
I have tried a few times to find a solution to this, but still haven't.

I have a macro which carries out multiple web queries using a URL found on sheet "postcodes"
In versions of excel before 2010 it works no problem but in 2010 it hangs, not always on the same URL and sometimes it runs all the way through no problem.

I've read that "pinging" the URL before the web query may help.

If this is true please can someone help me with the code that I would need to include

An example URL is
Weather forecast for Postcode TR1 | Local | Cornwall, United Kingdom

My code is:

Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8"


With Sheets("Download").QueryTables.Add(Connection:="URL;" & Sheets("Postcodes").Range("B4").Value, _
Destination:=Sheets("Download").Range("$A$1"))
.Name = "web_query"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Sheets("Download").QueryTables(1).Delete

Application.Wait Now + TimeValue("00:00:01") 'this pauses macro for 1 second
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,375
Messages
6,124,578
Members
449,174
Latest member
chandan4057

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