eastrand
Board Regular
- Joined
- Nov 27, 2013
- Messages
- 101
- Office Version
- 365
- Platform
- Windows
I have a built in webBrowers in a Userform. The page I'm going to will autoforward if it has been logged into within the last 2 hours. I'm trying to check for the login table on the page and if it finds it, push the login in credentials to that page. If it can't find that table, then it must already be logged in. Currently I'm using the "If Doc.getElementById("tbxUserName").Value = "" Then" to try to see if the id value is there. but this isn't working. Does anyone know how to verify if a table or field exist on a webpage within a WebBrowser control? Any help would be appreciated.
Private Sub UserForm_Initialize()
Dim IE As Object
Dim Doc As HTMLDocument
Set IE = Me.WebBrowser1
Me.WebBrowser1.Silent = True
Me.WebBrowser1.Navigate "MedPro Mobile"
Do
DoEvents
Loop Until Me.WebBrowser1.ReadyState = READYSTATE_COMPLETE
Set Doc = IE.Document
If Doc.getElementById("tbxUserName").Value = "" Then
Doc.getElementById("tbxUserName").Value = Worksheets("Variables").Range("R2").Value
Doc.getElementById("tbxPassword").Value = Worksheets("Variables").Range("R3").Value
Doc.getElementById("btnLogin").Click
End If
Private Sub UserForm_Initialize()
Dim IE As Object
Dim Doc As HTMLDocument
Set IE = Me.WebBrowser1
Me.WebBrowser1.Silent = True
Me.WebBrowser1.Navigate "MedPro Mobile"
Do
DoEvents
Loop Until Me.WebBrowser1.ReadyState = READYSTATE_COMPLETE
Set Doc = IE.Document
If Doc.getElementById("tbxUserName").Value = "" Then
Doc.getElementById("tbxUserName").Value = Worksheets("Variables").Range("R2").Value
Doc.getElementById("tbxPassword").Value = Worksheets("Variables").Range("R3").Value
Doc.getElementById("btnLogin").Click
End If