I have following HTML code, that I want to retrieve data from:
<div class="span4">
<div>
<label for="Game_type">Portal Games</label>
XXX
</div>
<div>
<label for="Game_Reference">Game reference</label>
22130903
</div>
<div>
<label for="Release_Date">Release Date</label>
2015-07-13
</div>
<div>
<label for="Prise">Prise</label>
USD 90,00
</div>
<div>
<label for="Game_Rank">Game Rank</label>
4
</div>
</div>
How I am able to get all those label values/at least one value into MsgBox?. (Later I will input them into Excel myself)
I have tried using following code to get first value:
Dim IE As Object
Set IE = CreateObject("INTERNETEXPLORER.APPLICATION")
'page address is stated in code
IE.navigate "page name"
IE.Visible = True
While IE.Busy
'Wait until IE is busy and loading page
DoEvents
Wend
Set gtype = IE.Document.getElementsByClassName("span4")(0).getElementsById("Game_type")
GtypeValue = gtype.Value
MsgBox (GtypeValue)
End Sub
I received run-time error "91:"
Object variable or With Block variable not set.
150904 Hopefully last one question, regarding this topic.Default code looks like
strCont = objIE.Document.getElementsByClassName("span4")(0).innerHTML
But I want to have a variable instead of "span4", in example Dim1= "span4" I state following:
strCont = "objIE.Document.getElementsByClassName(" & Chr(34) & Dim1 & Chr(34) & ")(0).innerHTML"
It does not work, empty value in MsgBox. How can I make sure that this sting will be counted as exact code to be executed later in step:
Set objMatches = .Execute(strCont)