Putting WEBSERVICE in a loop until it is not 404

I am trying to fetch exchange rates from a website in a function. I enter the date in the URL. The website returns a 404 error for days entered that happen to be weekends. I catch that as On Error and return 0.

I want to decrement the date by one and try again, in a loop, until I get a rate for that row.

However, when I put the On Error in a loop, to decrement the date until I get a real return from the xml site, the function gives an error: My Macros window comes up with an error msgbox.

Any ideas?

“I do something obscure, and get some problem. Any ideas?”

That is what you actually wrote. No macro listed; no website URL mentioned; no specific error message provided. Not to say that LibreOffice and OS information (including versions) is totally missing.