ScottSmallwood
New Member
- Joined
- Oct 17, 2012
- Messages
- 3
I am trying to navigate through a number of web pages using VBA. I first goto the login page and login using my password. When I click do ieForm.submit the actual IE application goes to the next page, but my IE object is still looking at the old web page.
Here is my code. Any help would be much appreciated. Thanks.
Sub IE_login()
Dim IE As InternetExplorer, ieForm
Dim MyPass As String, MyLogin As String
Application.StatusBar = "Loading 5Dimes"
' MyLogin = Application.InputBox("Please 5Dimes login", "5Dimes UserName", Default:="password", Type:=2)
' MyPass = Application.InputBox("Please 5Dimes password", "5Dimes Password", Default:="password", Type:=2)
MyLogin = "test"
MyPass = "dummy"
Set IE = New InternetExplorer
IE.Visible = True
IE.Navigate "http://www.5dimes.eu/"
'Loop until ie page is fully loaded
Do Until IE.ReadyState = READYSTATE_COMPLETE
Loop
' Look for password Form by finding test "Password"
Application.StatusBar = "Logging On"
For Each ieForm In IE.Document.forms
If (ieForm.Name = "LoginForm") Then
ieForm(0).Value = MyLogin
ieForm(1).Value = MyPass
ieForm.submit
Exit For
End If
Next
Dim x As Variant
Set x = IE.Document.getElementById("Basketball_Reduced")
IE.Document.getElementById("Basketball_Reduced").Checked = True
IE.Document.submit
End Sub
Here is my code. Any help would be much appreciated. Thanks.
Sub IE_login()
Dim IE As InternetExplorer, ieForm
Dim MyPass As String, MyLogin As String
Application.StatusBar = "Loading 5Dimes"
' MyLogin = Application.InputBox("Please 5Dimes login", "5Dimes UserName", Default:="password", Type:=2)
' MyPass = Application.InputBox("Please 5Dimes password", "5Dimes Password", Default:="password", Type:=2)
MyLogin = "test"
MyPass = "dummy"
Set IE = New InternetExplorer
IE.Visible = True
IE.Navigate "http://www.5dimes.eu/"
'Loop until ie page is fully loaded
Do Until IE.ReadyState = READYSTATE_COMPLETE
Loop
' Look for password Form by finding test "Password"
Application.StatusBar = "Logging On"
For Each ieForm In IE.Document.forms
If (ieForm.Name = "LoginForm") Then
ieForm(0).Value = MyLogin
ieForm(1).Value = MyPass
ieForm.submit
Exit For
End If
Next
Dim x As Variant
Set x = IE.Document.getElementById("Basketball_Reduced")
IE.Document.getElementById("Basketball_Reduced").Checked = True
IE.Document.submit
End Sub
Last edited by a moderator: