• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA query for extracting innertext using tagname and class name

Rizwan Ahmed

New Member
Dear,

My name is Rizwan Ahmed, I am using microsoft excel 2007. I have problem with VBA Scripting.
I want to search the element in webpage using tagname and classname and extract the inner text and display the message on msgbox.
This is a code when i typed number in cell field then required webpage will be open in internet explorer.
But my issue is that when webpage open, next i want i search the text using tagename and classname by inspecting element on webpage and extract the innertext and display on the message box.

Here is the code

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = Range("number").Row And _
Target.Column = Range("number").Column Then
  Dim IE As New InternetExplorer
  IE.Visible = True
  IE.navigate "i.e any webpage link" & Range("number").Value
  Do
  DoEvents
  Loop Until IE.readyState = READYSTATE_COMPLETE
  Dim Doc As HTMLDocument
  Set Doc = IE.document  
  End If
End Sub

Regards
 
Last edited by a moderator:
Back
Top