Web query error handling...

Matty

Well-known Member
Joined
Feb 17, 2007
Messages
3,710
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
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Watch MrExcel Video

Forum statistics

Threads
1,108,999
Messages
5,526,167
Members
409,685
Latest member
Bellybb

This Week's Hot Topics

Top