Search OuterText or OuterHTML

Posted on 2006-04-26
Last Modified: 2008-02-26
I want to search the OuterText or OuterHTML of a browser control for a certain word. Please advise.
Question by:John Account
    LVL 12

    Expert Comment

    what is OuterText or OuterHTML?

    LVL 28

    Accepted Solution

    Something like this?

    Private Sub Command1_Click()
    WebBrowser1.Navigate2 ""
    End Sub

    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    Dim pos1 As String, pos2 As String
    Dim strData As String, SearchWord As String
    strData = WebBrowser1.Document.Body.OuterText

    SearchWord = "Puzzles"

    pos1 = InStr(strData, SearchWord)
    If pos1 > 0 Then
        MsgBox "String was found at position " & pos1
        MsgBox "String was not found"
    End If
    End Sub

    Author Comment

    by:John Account
    Thanks, vinnyd79.

    That was an example of what OuterText is, BobLamberson. As far as I know, OuterHTML is basically the same thing--it's not the html. It's the text that is rendered by the html.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now