whose2know
Board Regular
- Joined
- May 1, 2002
- Messages
- 59
I'm trying to update code that I've used for years to logon to websites to get information. I've used sendkeys to transfer IDs/Passwords to sites for years, and it still works, but thought I would get the code current. I use XL2007 and I've searched on the board and can pass the password and ID to the site, but I can't get the "Sign In" button to click. All help is appreciated. Here's the code I'm working with now:
Sub LO()
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.navigate "http://www.duke-energy.com/north-carolina.asp" ' sign on page
.Visible = 1
Do While .busy: DoEvents: Loop
Do While .readystate <> 4: DoEvents: Loop
Set htmlDoc = .document
Set htmlColl = htmlDoc.getElementsByTagName("INPUT")
For Each htmlInput In htmlColl
If htmlInput.Name = "userId" Then _
htmlInput.Value = "myID"
If htmlInput.Name = "userPassword" Then _
htmlInput.Value = "myPW"
Next htmlInput
Do While .readystate <> 4: DoEvents: Loop
For Each htmlInput In htmlColl
If htmlInput.Name = "signin_btn" Then
htmlInput.Click ' CANT GET TO CLICK BUTTON
Exit For
End If
Next htmlInput
End With
End Sub
Sub LO()
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.navigate "http://www.duke-energy.com/north-carolina.asp" ' sign on page
.Visible = 1
Do While .busy: DoEvents: Loop
Do While .readystate <> 4: DoEvents: Loop
Set htmlDoc = .document
Set htmlColl = htmlDoc.getElementsByTagName("INPUT")
For Each htmlInput In htmlColl
If htmlInput.Name = "userId" Then _
htmlInput.Value = "myID"
If htmlInput.Name = "userPassword" Then _
htmlInput.Value = "myPW"
Next htmlInput
Do While .readystate <> 4: DoEvents: Loop
For Each htmlInput In htmlColl
If htmlInput.Name = "signin_btn" Then
htmlInput.Click ' CANT GET TO CLICK BUTTON
Exit For
End If
Next htmlInput
End With
End Sub