Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default "On Error" not working for web queries

Why does "On Error" seem to make no difference? Once every few hundred web
queries will fail because of some timeout or webpage not being available but
the "On Error" doesn't seem to help. The error is always on the last line:
".Refresh BackgroundQuery:= False".

Any insight would be appreciated.

Regards,
Brian

code
excerpt........................................... ...............................

On Error GoTo query3error

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q?s=" & ticker,
Destination:=Range("A1"))
.Name = "q?s=" & ticker
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False ' was True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.webtables = webtables(trials - 1) ' was "16"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = True ' was False
.Refresh BackgroundQuery:=False
End With
--
Brian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default "On Error" not working for web queries

goto
http://groups.yahoo.com/group/xltraders/
join
look for donaldb36 as author and download a free file to do it all for you.


--
Don Guillett
SalesAid Software

"Brian in London" wrote in message
...
Why does "On Error" seem to make no difference? Once every few hundred
web
queries will fail because of some timeout or webpage not being available
but
the "On Error" doesn't seem to help. The error is always on the last
line:
".Refresh BackgroundQuery:= False".

Any insight would be appreciated.

Regards,
Brian

code
excerpt........................................... ...............................

On Error GoTo query3error

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q?s=" & ticker,
Destination:=Range("A1"))
.Name = "q?s=" & ticker
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False ' was True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.webtables = webtables(trials - 1) ' was "16"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = True ' was False
.Refresh BackgroundQuery:=False
End With
--
Brian



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
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM
What is Error "Method "Paste" of object "_Worksheet" failed? vat Excel Programming 7 February 17th 06 08:05 PM
Working out age from "Day" "Month" "Year" timmyc Excel Worksheet Functions 4 February 5th 06 03:07 PM
"on error resume next" NOT working... Chris M Excel Programming 2 July 13th 05 10:30 PM
Getting "compile error" "method or data member not found" on reinstall Bp Excel Programming 1 April 23rd 04 04:42 PM


All times are GMT +1. The time now is 10:24 PM.

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"