How to verify text (text box properties) / page title of IE using excel VBA.
How to verify text (text box properties) / page title of IE using excel VBA.
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.