I’m fairly experienced in VBA, and have been for many years. But this error has me pulling my hair out. I copied a simple routine from instructions on “webscraping with VBA” and keep getting this error. The code is simple, and adheres to all the suggestions, recommendations, and usage criteria that I could find.
The script errors at the line immediately after “For num = 1 to 5”
What’s curious about the situation is that when the error occurs, if I select “Debug” then step into the code from the point of failure, it will work correctly. It also works if I start stepping through it beginning at line 1. Apparently, something isn’t getting set correctly at some point. Time, maybe? I’ll attach a screenshot and hope someone can point out what I seem to be missing.
The code is a simple script to pull quotes from a website, and was taken from an instruction here: https://oxylabs.io/blog/web-scraping-excel-vba.
I’ve looked at all the MS criteria for properly setting and using variables (most of which I’m already aware of, but didn’t want to skip a step) as well as other forums discussing this error. Most of the “solutions” were old, but I think still apply. They all pretty much say the same but don’t resolve my problem.
Any help would be greatly appreciated.
Steps taken described above.
Richard C is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.