hi,
I have access code that performs opens excel and runs web queries. Not all the time but randomly I will get this error.
Run-time error '1004';
Unable to open
The connection to this Internet site took longer than the alloted time.
The highlighted code above is where is always errors at. I can hit the debug button and restart the code and everything works fine.
My question is, What can I put in that if this happens to retry (basically what I do when I hit debug and restart the code)?
Thanks,
Randy
I have access code that performs opens excel and runs web queries. Not all the time but randomly I will get this error.
Run-time error '1004';
Unable to open
The connection to this Internet site took longer than the alloted time.
Code:
Set dbase = CurrentDb
Set objXL = New Excel.Application
With objXL
.Visible = True
Set objWKB = .Workbooks.Open(ConWKBK)
Set objWSHT01 = objWKB.Worksheets("DATA")
objWSHT01.Activate
With objWSHT01.QueryTables.Add(Connection:=objRst01, _
Destination:=objWSHT01.Range("a1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = True
[highlight].Refresh BackgroundQuery:=False[/highlight]
.SaveData = True
End With
The highlighted code above is where is always errors at. I can hit the debug button and restart the code and everything works fine.
My question is, What can I put in that if this happens to retry (basically what I do when I hit debug and restart the code)?
Thanks,
Randy