gsouza
08-28-2006, 07:34 AM
I am trying to auto login to this sight http://www1.mscdirect.com/cgi/nnsrhmSub
IE_login()
Dim ie As InternetExplorer
Dim C
Dim ULogin As Boolean, ieForm
Dim MyPass As String, MyLogin As String
redo:
MyLogin = Application.InputBox("Please enter your VBAX login", "VBAX username", Default:="login", Type:=2)
MyPass = Application.InputBox("Please enter your VBAX password", "VBAX Password", Default:="Password", Type:=2)
If MyLogin = "" Or MyPass = "" Then GoTo redo
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate "http://www1.mscdirect.com/cgi/nnsrhm"
'Loop until ie page is fully loaded
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
'Look for password Form by finding test "Password"
For Each ieForm In ie.Document.forms
If InStr(ieForm.innertext, "Password") <> 0 Then
ULogin = True
'enter details
ieForm(0),Value = MyLogin
ieForm(1).Value = MyPass
'login
ieForm.submit
Exit For
Else
End If
Next
If ULogin = False Then MsgBox "User is aleady logged in"
Set ie = Nothing
End Sub
I can't seem to get the text of the input boxes into the proper fields on the sight. I can't seem to get the text of the input boxes to populate any feilds in that sight. Can anybody help me auto login.
Thank you
IE_login()
Dim ie As InternetExplorer
Dim C
Dim ULogin As Boolean, ieForm
Dim MyPass As String, MyLogin As String
redo:
MyLogin = Application.InputBox("Please enter your VBAX login", "VBAX username", Default:="login", Type:=2)
MyPass = Application.InputBox("Please enter your VBAX password", "VBAX Password", Default:="Password", Type:=2)
If MyLogin = "" Or MyPass = "" Then GoTo redo
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate "http://www1.mscdirect.com/cgi/nnsrhm"
'Loop until ie page is fully loaded
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
'Look for password Form by finding test "Password"
For Each ieForm In ie.Document.forms
If InStr(ieForm.innertext, "Password") <> 0 Then
ULogin = True
'enter details
ieForm(0),Value = MyLogin
ieForm(1).Value = MyPass
'login
ieForm.submit
Exit For
Else
End If
Next
If ULogin = False Then MsgBox "User is aleady logged in"
Set ie = Nothing
End Sub
I can't seem to get the text of the input boxes into the proper fields on the sight. I can't seem to get the text of the input boxes to populate any feilds in that sight. Can anybody help me auto login.
Thank you