I'm trying to use VBA to go to a website that requires a User Name, Password, and a Submit Button.
So far I can get everything to work besides the Submit part. The code runs without errors, but doesn't actually "hit" the submit button on the webpage.
For posting, I removed my actual user name and password and and used the generic "User Name" and "Password" highlighted in blue.
I highlighted another section in green that I took from a previous post hoping it would solve my problem. The link is: http://www.mrexcel.com/forum/showthread.php?t=317060&highlight=vba+internet+explorer+submit
Here is the code I am using:
Sub GoToWebSiteAndPlayAroundNew()
Dim appIE As Object ' InternetExplorer.Application
Dim URL As String
Set appIE = CreateObject("InternetExplorer.Application")
URL = "https://efolio.morgankeegan.com/escripts/defaultLogon.asp?errCode=2"
With appIE
.navigate URL
.Visible = True
Do While .busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
.document.getelementbyid("fUserName").Value = "UserName"
.document.getelementbyid("fPassword").Value = "Password"
End With
On Error Resume Next
x = 0
For Each mitem In IE.document.all
mitem.Value = "x"
x = x + 1
Next
x = 0
For Each mitem In IE.document.all
If x = "Submit" Then
mitem.Click
Exit For
End If
Next
End Sub
So far I can get everything to work besides the Submit part. The code runs without errors, but doesn't actually "hit" the submit button on the webpage.
For posting, I removed my actual user name and password and and used the generic "User Name" and "Password" highlighted in blue.
I highlighted another section in green that I took from a previous post hoping it would solve my problem. The link is: http://www.mrexcel.com/forum/showthread.php?t=317060&highlight=vba+internet+explorer+submit
Here is the code I am using:
Sub GoToWebSiteAndPlayAroundNew()
Dim appIE As Object ' InternetExplorer.Application
Dim URL As String
Set appIE = CreateObject("InternetExplorer.Application")
URL = "https://efolio.morgankeegan.com/escripts/defaultLogon.asp?errCode=2"
With appIE
.navigate URL
.Visible = True
Do While .busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
.document.getelementbyid("fUserName").Value = "UserName"
.document.getelementbyid("fPassword").Value = "Password"
End With
On Error Resume Next
x = 0
For Each mitem In IE.document.all
mitem.Value = "x"
x = x + 1
Next
x = 0
For Each mitem In IE.document.all
If x = "Submit" Then
mitem.Click
Exit For
End If
Next
End Sub