Consulting

Results 1 to 2 of 2

Thread: verify text of IE

  1. #1
    VBAX Newbie
    Joined
    Aug 2009
    Posts
    2
    Location

    Post verify text of IE

    How to verify text (text box properties) / page title of IE using excel VBA.

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    Does this help?
    [vba]Public Sub Example()
    'Needed Project References:
    ' -Microsoft Internet Controls
    ' C:\Windows\system32\ieframe.dll
    ' -Microsoft HTML Object Library
    ' C:\Windows\system32\mshtml.tlb
    Dim ie As SHDocVw.InternetExplorer
    Dim doc As MSHTML.HTMLDocument
    Dim tbx As MSHTML.HTMLInputTextElement
    Dim btn As MSHTML.HTMLButtonElement
    Set ie = New SHDocVw.InternetExplorer
    ie.Visible = True
    ie.Navigate "http://www.google.com"
    WaitForPageLoad ie
    Set doc = ie.Document
    Set tbx = doc.getElementsByName("q").Item(, 0)
    tbx.Value = "VBA Express"
    MsgBox "The textbox now says: " & tbx.Value
    Set btn = doc.getElementsByName("btnG").Item(, 0)
    btn.Click
    WaitForPageLoad ie
    End Sub

    Private Sub WaitForPageLoad(ByRef ie As SHDocVw.InternetExplorer)
    Do Until ie.ReadyState = READYSTATE_COMPLETE
    DoEvents
    Loop
    End Sub
    [/vba]
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •