Hello everyone,

I've a problem with a macro that has been working pretty well over the past year.

The macro connects to an internet website and save the page into a spreadsheet and then I retrieve some parts for dedicated field.

However, for the past days, it seems like I can't access to the website if I do too many requests. I receive an error "run-time error '1004' unable to open http://www.verif.com/societe/070801568 Cannot download the information you requested" executing web query from Excel"

I know that by pausing my macro 2seconds, it works for most of the cases, but not always and I still get sometimes the error. Since the macro is doing thousands of requests, I'd like those errors to be handled by the macro.

Here is my code that causes the problem

With Sheets("Temp")
        With .QueryTables.Add(Connection:= _
            "URL;http://www.verif.com/societe/" & SIREN, Destination _
            :=Sheets("Temp").Cells(1, 1))
            .RefreshPeriod = 0
            .Refresh BackgroundQuery:=False
        End With
End with
SIREN is a variable

What I'd like to do with this is that "while I get the error", try to do the above mentionned code. And when it works, then it proceeds to the next parts of the macro.
In case there is an infinite problem (i.e wrong URL), I could specified a maximum number of attempts or time to wait in this loop, if needed.

Is there any way to do such things ? The problem occurs immediately after the first "end with" when excel tries to connect to the internet.

Any question, please let me know

Thanks a lot for your help

Eric