View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dj dj is offline
external usenet poster
 
Posts: 92
Default Refreshing Web Queries and DisplayAlerts

Im working with a series of macros (Excel 2003) that schedule hourly updates
of a bunch of web queries, and then process each hour's query results. The
scheduling macro calls up the refresh and processing macros.

I have been using Application.DisplayAlerts = False in the beginning of both
the scheduling macro, and the refresh macro. None of the referenced macros
include Application.DisplayAlerts = True. However, when one of the queried
websites cannot be opened, a pop-up box states:

€śUnable to open http://[web address]. Cannot download information you
requested.€ť

This box stops the macros from continuing until it is clicked by a person.
How can I stop alerts that occur during web query refreshes? Some of the
code Im using follows:

Sub SetSchedule ()
Application.DisplayAlerts = False
Sheets(€śData€ť).Select
Range(€śg5:z5€ť).Select
For Each Item in Selection
Application.OnTime Item.Value, €śRefresh€ť
Application.OnTime Item.Value + TimeValue(€ś00:10:00€ť), €śMacro3€ť
Application.OnTime Item.Value + TimeValue(€ś00:11:00€ť), €śMacro4€ť
Next Item
End Sub

Sub Refresh ()
Windows(€śfilename.xls€ť).Activate
Application.StatusBar = €śProcessing Refresh€ť
Application.DisplayAlerts = False
Sheets(€śData€ť).Select
Range(€śc3€ť).Select
ActiveCell = Now()
Application.ScreenUpdating = False
ActiveWorkbook.RefreshAll
Application.OnTime Now + TimeValue(€ś00:02:30€ť), €śMacro5€ť
End Sub

Sub Macro5 ()
Application.ScreenUpdating = True
Application.StatusBar = €śScheduled Updates are Running€ť
End Sub