Hi All,
I have searched for several hours with no luck. What I would like to do is this: I have a vba code with the help of this code I want to get data from span class.
My HTML code
My vba code
I have searched for several hours with no luck. What I would like to do is this: I have a vba code with the help of this code I want to get data from span class.
My HTML code
HTML:
<div class="mw_tabContent" style="overflow: hidden; height: 49px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; display: block;"> <ul class="mw_contentList highLgt" id="highlightContent"> <li id="Highlights1" category="Banks" style="background-color: rgb(244, 243, 238); color: rgb(51, 51, 51);" class="act_Highl"> <i class="mw_listIcon mw_iconsprite webIconRedBanks"></i> <span class="mw_content" title="State Bank Of India">State Bank Of India</span> <span class="mw_units">15 min|4.9 km</span> </li> </ul>
My vba code
Code:
Sub GoToWebSiteAndPlayAround()
Dim IE As New InternetExplorer
IE.navigate "my url"
IE.Visible = False
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Application.Wait (Now() + TimeValue("00:00:02"))
Dim doc As HTMLDocument
Set doc = IE.document
Dim dd As Variant
dd = doc.getElementsByClassName("mw_content")(0).innerText
Sheets("Sheet1").Range("A2").Value = dd
IE.Quit
End Sub