I spent several hours researching this, couldn't find a solution.
I'm trying to do a relatively simple VBA web scrape on google. I'm currently hung up on inputting text into google's search box. There are three different routes I have seen, all of which cause errors.
One route is the following code
Dim aEXPLORER as InternetExplorer
Set aEXPLORER = New InternetExplorer
Do While aEXPLORER.readyState <> READYSTATE_COMPLETE
Application.StatusBar = "Loading google..."
DoEvents
Loop
At this point, the first route goes like this:
aEXPLORER.Document.Getelementbyid("idhere").value
The problem is after .document my intellisense stops working. If I continue to write the code anyway it errors out.
Route two - add at the top dim aHTML as HTMLDocument
Set aHTML = aEXPLORER.document
aHTML.getElementById("idhere").value
This is marginally more successful as I get to the getelementbyID tag but my intellisense doesn't find a .value anywhere. I have a lot of other options like innertext, etc. But no .value like several people use in tutorials online.
I looked in my object libraries and I don't see a .value in my HTMLDocument library or my InternetExplorer library or my Excel library.
The problem has to be something with declaring a variable or an object or something of that nature. Why don't I ever get to a .value? This first method worked online for three different people showing tutorials, why isn't it working when I do it? How are they getting a Getelementbyid tag without setting up an HTML document at the top? For reference, this popular tutorial uses method one, "http://ift.tt/29pJpUS" about 75% of the way through the tutorial.
Thank you so much for being such helpful people. I'm at the end of my currently very limited rope.
Aucun commentaire:
Enregistrer un commentaire