Web query error handling...

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,717
Hi Team,

I have the following code that returns data from the web (via Power Query):

Code:
    Application.ScreenUpdating = False
    If CheckBox1.Value = True Then
        Sheet3.Range("B4").ListObject.QueryTable.RefreshPeriod = 1
    Else
        Sheet3.Range("B4").ListObject.QueryTable.RefreshPeriod = False
    End If
    Application.ScreenUpdating = True

It works well, but if the query fails (DataSource.Error, etc.), a pop up window will appear with the error code encountered. This then means that the 60 second refresh period stops due to the error message window requiring manual closure.

How would you guys handle this? I need either the error message to be ignored or for the error message window to close automatically after a few seconds.

Thanks,

Matty
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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