Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Web query - when does error occur so I can trap it?

I am utilizing web queries and other code to copy data all day.

The problem I am having is that I want this program to continually run
without much user intervention, but when there is a problem obtaining data
(website is down, etc out of the codes control), an message displays. The
user can hit okay , and the macro will resume, but I'd like to find a way
around this.

As per Dick Kusleika's blog

See http://www.dicks-blog.com/archives/2...-other-events/

I was able to use the afterrefresh property to copy values only after the
webquery data was obtained. I figured perhaps adding an On Error Resume
Next in the refresh property ie:

Private Sub gcQueryTable_AfterRefresh(ByVal Success As Boolean)
On Error Resume Next
MsgBox ("After refresh property")
CopyIMODataToMainTracking
Fillin3HourDataForChart
End Sub

HOwever, the "can't find data" error pops up before the messagebox, so I
don't believe this will help me trap the error.

Using Application.DisplayAlerts = False doesn't appear to work either, but
I'm unsure where this should be placed.

Is there any other way to prevent these error messages?

The problem I think is that the error occurs "outside" the procedures (ie
that's why error methods and display alerts doesn't work, since they are used
within confines of a procedure.)

Any ideas?

Thanks again,

Matt Lawson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Web query - when does error occur so I can trap it?

Perhaps you could check the Success variable.

If Success Then
MsgBox "After refresh property"
...
End If


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Matt Lawson" wrote in message
...
I am utilizing web queries and other code to copy data all day.

The problem I am having is that I want this program to continually run
without much user intervention, but when there is a problem obtaining data
(website is down, etc out of the codes control), an message displays.
The
user can hit okay , and the macro will resume, but I'd like to find a way
around this.

As per Dick Kusleika's blog

See http://www.dicks-blog.com/archives/2...-other-events/

I was able to use the afterrefresh property to copy values only after the
webquery data was obtained. I figured perhaps adding an On Error
Resume
Next in the refresh property ie:

Private Sub gcQueryTable_AfterRefresh(ByVal Success As Boolean)
On Error Resume Next
MsgBox ("After refresh property")
CopyIMODataToMainTracking
Fillin3HourDataForChart
End Sub

HOwever, the "can't find data" error pops up before the messagebox, so I
don't believe this will help me trap the error.

Using Application.DisplayAlerts = False doesn't appear to work either, but
I'm unsure where this should be placed.

Is there any other way to prevent these error messages?

The problem I think is that the error occurs "outside" the procedures (ie
that's why error methods and display alerts doesn't work, since they are
used
within confines of a procedure.)

Any ideas?

Thanks again,

Matt Lawson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error occur while loading Sheet1811111111111111111" HELP!! Charles Excel Discussion (Misc queries) 0 July 8th 08 08:10 PM
Please help - Looking for a way to sum up for specific error codes that occur in multiple months. Joe Excel Discussion (Misc queries) 4 June 17th 06 04:15 AM
error trap Rhonda[_3_] Excel Programming 2 October 22nd 03 07:07 PM
VBA occur error - kernel32.dll Judy[_4_] Excel Programming 1 August 20th 03 10:43 AM


All times are GMT +1. The time now is 05:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"