Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Run-time Error 1004 - retry x times or end

Hi - am using the following querytable code to retrive data from a internet
site into excel where qurl is my webaddress.

With DataSheet.QueryTables.Add(Connection:="URL;" & qurl,
Destination:=DataSheet.Range(qStart))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

'Sometimes' I get Run-time error 1004. Unable to open (i.e. the aurl I have
specified). I know the link I have specified is valid, just that it fails
sometimes as if i continue from the break, it will complete after a retry or
2.

Can I somehow trap Error Code 1004 so that I can retry x times (say 5
times). If this fails, then end the sub-routine and run msgbox("The link is
currebtly unavailalbe").

This sounds logical to me, but I got no idea how to program it.
Bruce
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Run-time Error 1004 - retry x times or end

Try On Error Resume Next before your query code to stop the error from
halting the code.

Mike F
"Bruce" wrote in message
...
Hi - am using the following querytable code to retrive data from a
internet
site into excel where qurl is my webaddress.

With DataSheet.QueryTables.Add(Connection:="URL;" & qurl,
Destination:=DataSheet.Range(qStart))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

'Sometimes' I get Run-time error 1004. Unable to open (i.e. the aurl I
have
specified). I know the link I have specified is valid, just that it fails
sometimes as if i continue from the break, it will complete after a retry
or
2.

Can I somehow trap Error Code 1004 so that I can retry x times (say 5
times). If this fails, then end the sub-routine and run msgbox("The link
is
currebtly unavailalbe").

This sounds logical to me, but I got no idea how to program it.
Bruce



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Run-time Error 1004 - retry x times or end

Thnak Mike - 2 questions

1. Do i put this line before my code?

2. qurl is an erray element. Will resume make it skip this element or retry
the one that caused the code to halt (as I want it to retry x times and then
exit if it fails?

Bruce

"Mike Fogleman" wrote:

Try On Error Resume Next before your query code to stop the error from
halting the code.

Mike F
"Bruce" wrote in message
...
Hi - am using the following querytable code to retrive data from a
internet
site into excel where qurl is my webaddress.

With DataSheet.QueryTables.Add(Connection:="URL;" & qurl,
Destination:=DataSheet.Range(qStart))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

'Sometimes' I get Run-time error 1004. Unable to open (i.e. the aurl I
have
specified). I know the link I have specified is valid, just that it fails
sometimes as if i continue from the break, it will complete after a retry
or
2.

Can I somehow trap Error Code 1004 so that I can retry x times (say 5
times). If this fails, then end the sub-routine and run msgbox("The link
is
currebtly unavailalbe").

This sounds logical to me, but I got no idea how to program it.
Bruce




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
run time error 1004 general odbc error excel 2003 vba Mentos Excel Programming 5 January 24th 11 02:56 PM
Run Time Error 1004: Application or Object Defined Error BEEJAY Excel Programming 4 October 18th 06 04:19 PM
Run Time 1004 Error: Application or Object Difine Error BEEJAY Excel Programming 0 October 17th 06 10:45 PM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM


All times are GMT +1. The time now is 02:58 AM.

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

About Us

"It's about Microsoft Excel"