Jump to content

Grab Text within IE

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
xxarmoxx

xxarmoxx

    Newbie

  • Members
  • PipPip
  • 10 posts
Does anyone know how to grab text within IE? For example, if I am typing text into this text box right now, how can I grab it using VB .net?

#2
Guest_NeedHelp_*

Guest_NeedHelp_*
  • Guests
You need to connect to the running instance of IE first:

Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer

Private Sub Form_Load()
   Dim Doc
   List1.Clear
   List2.Clear

   Text1.Text = SWs.count

   For Each IE In SWs
      List1.AddItem IE.LocationName

      Set Doc = IE.Document
      If TypeOf Doc Is HTMLDocument Then
         'if this is an HTML page, display the title
         'may or may not be the same as LocationName
         List2.AddItem Doc.Title
      End If
   Next
End Sub

And from there I'm sure you can grab the text. More info and the code above from: How to connect to a running instance of Internet Explorer