How To Access Innertext Of Html Tag Inside A Tag
I would like to get some text from a web page containing this. I want to have the piece of information with the href='#spec_Brand'. Solution 1:
Is this what you are trying? (Note: I stored the above html in Cell A1 of Sheet1 for testing). Also I am using Late Binding with IE
Option Explicit
Sub Sample()
Dim ie AsObject
Dim links As Variant, lnk As Variant
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "About: Blank"
ie.document.body.innerhtml = Sheets("Sheet1").Range("A1").Value
Set links = ie.document.getElementsByTagName("a")
For Each lnk In links
If lnk.classname = "href_icon href_icon_help table_spec_titleimg" Then
Debug.Print lnk.innertext
ExitFor
End If
Next
End Sub
SCREENSHOT
I would like to get some text from a web page containing this. I want to have the piece of information with the href='#spec_Brand'.
Solution 1:
Is this what you are trying? (Note: I stored the above html in Cell A1 of Sheet1 for testing). Also I am using Late Binding with IE
Option Explicit
Sub Sample()
Dim ie AsObject
Dim links As Variant, lnk As Variant
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "About: Blank"
ie.document.body.innerhtml = Sheets("Sheet1").Range("A1").Value
Set links = ie.document.getElementsByTagName("a")
For Each lnk In links
If lnk.classname = "href_icon href_icon_help table_spec_titleimg" Then
Debug.Print lnk.innertext
ExitFor
End If
Next
End Sub
SCREENSHOT
Post a Comment for "How To Access Innertext Of Html Tag Inside A Tag"