PDA

View Full Version : Check the status of the HTML form submitted using Excel



rupeshkumar_
08-11-2011, 05:20 AM
Hi,

I have a function in excel which opens a login form on Internet Explorer, populates the username & password values and clicks on login button.

Here, I want to get the status of the login, whether the login was successful or it threw and error.

Can someone help please !

Here is the function code:



Function Login()
Dim myIE As SHDocVw.InternetExplorer

'check if page is already open
Set myIE = GetOpenIEByURL(Login_url)

If myIE Is Nothing Then
'page isn't open yet. create new IE instance
Set myIE = GetNewIE
'make IE window visible
myIE.Visible = True
'load page
If LoadWebPage(myIE, Login_url) = False Then
'page wasn't loaded
MsgBox "Couldn't open page"
Exit Sub
Else
With myIE.document.forms(form_name)
.elements(username_id).Value = username
.elements(password_id).Value = password
.elements(Loginbtn_id).Click
End With
End If
End If
End Function