Forum Discussion
VBA troubleshooting: "Object variable or With block variable not set" How do I fix this?
Okay, awesome news! Thanks to all your help Zack, I got the second macro to do what I want it to! Holy cow - this is beyond amazing since it will save me HOURS of repetitive manual labour replacing symbols and prohibited words with spaces or flat-out nothing.
I thought I'd posted another questions about how I got stuck, but I don't see it here. I kept playing around with the problem and managed to fix it despite being clueless haha So if that new question from today DOES show up, you can ignore it.
Thanks again!!! :D
Very much appreciate the follow-up. It helps us know that what we do is worth it.
- Zack BarresseFeb 22, 2019Iron Contributor
Gijs1 please start your own thread. Feel free to message me the link. Also, your code looks fine and you shouldn't be getting that error. You would, however, need two references (Tools > References...) Microsoft HTML Object Library and Microsoft Internet Controls.
- Gijs1Feb 20, 2019Copper Contributor
Hey guys,
I am trying to fill-in data in a website with VBA, but I am getting a run time error 91. I have the idea that there is an error due to auto-complete, but I am not 100% sure.
The website is to calculate travel time, the value is (Dutch) travel data.
Who can help me?
VBA Code:
--------------------------------------------------------------------------------------
Sub GetHTMLDocument()
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
Dim HTMLButtons As MSHTML.IHTMLElementCollection
Dim HTMLButton As MSHTML.IHTMLElement
IE.Visible = True
IE.navigate "https://www.anwb.nl/verkeer/routeplanner"
Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop
Set HTMLDoc = IE.Document
Set HTMLInput = HTMLDoc.getElementById("routing-input-address-field-0")
HTMLInput.Value = "9711NA"
End Sub-----------------------------------------------------------------------------------