I've used this VBA subroutine to login into another site, and it's working ok. At the site at the URL below, the userid and password fields are populated with the correct values, but I can't seem to create code that will click the login button. Clicking it manually works, so my userid or password aren't corrupted. I've tried many things, as you can see - even SendKeys! I've included the HTML below my code, the login button is the last element at the end. Any help on clicking that button would be really appreciated - I don't have much hair left!!!
@@@@@@@@@@ My Code @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@ HTML code snippet I've been working with @@@@@@@@@@@@@@@@@@@
<label for="loginUserID" class="labelMargin loginLabel">
User ID
</label>
<input name="userName" maxlength="50" value="" id="loginUserID" class="fullWidth ensightenEvent" aria-describedby="loginUserIDdes loginUserIDdes1" data-type="field" data-reason="login" type="text">
Case-sensitive, may differ from your Amazon.com User ID
<label for="loginPassword" class="labelMargin loginLabel">
Password
</label>
<input name="password" maxlength="20" id="loginPassword" class="fullWidth ensightenEvent" aria-describedby="loginPassworddes" data-type="field" data-reason="password" type="password">
<input class="customInput ensightenEvent" id="rememUID" aria-describedby="rememUIDdes" *******="javascript:setRememberMeFlag(this.id);" data-reason="login:start:remember user id" data-type="field" type="checkbox">
<label for="rememUID" class="pull-left rememberme" id="rememUIDdes">Remember User ID</label>
<a href="javascript<strong></strong>:loginSubmit('../Login/loginSubmit.action', 'loginForm');" title="Login to your account" id="secLoginBtn" data-reason="login:start:submit" data-type="button"
class="btn secLoginBtn secureLockImg ensightenEvent">
Secure Login
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@ My Code @@@@@@@@@@@@@@@
Code:
Sub GetAmazonStoreCardBalance()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
Dim sBalance As String
On Error GoTo Err_Clear
MyURL = "https://www.synchronycredit.com/eSecurity/Login/login.action?clientId=amazon&accountType=plcc&langId=en"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.Visible = True
MyBrowser.Navigate MyURL
Do 'wait for page to load
Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
' the login page shows up first, so we enter our login info
HTMLDoc.all("loginUserID").Value = "my userid"
HTMLDoc.all("loginPassword").Value = "my password"
' this code worked for me for a different website, but won't work here
For Each MyHTML_Element In HTMLDoc.getElementsById("secLoginButton")
If MyHTML_Element.Type = "button" Then
MyHTML_Element.Click
Exit For
End If
Next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' here's some other things I've tried:
' let' try finding it by Class
' For Each MyHTML_Element In HTMLDoc.getElementsByClass("pull-right mTop20 mRight30 mLeft80")
' let's try clicking EVERY element in this outer element
' MyHTML_Element.Click
' Next
' this code worked for somebody else, let's try it
' HTMLDoc.forms(0).submit
' another variation I found online
' HTMLDoc.forms(1).submit
' let's trying tabbing to the button, and then send an 'enter' - I tried a number of different tabs
'For x = 1 To 6
' SendKeys "{TAB}", True
'Next x
'SendKeys "{ENTER}", True
' let's add some wait time, to see if the next page will load
'Do 'wait for page to load
'Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' the rest of this code works fine...
' first we get all the tags
Dim tag
Dim tags As Object
Set tags = MyBrowser.Document.getElementsByTagName("*")
' then we go thru them to find the text that displays the balance
For Each tag In tags
If tag.className = "activityPayment" Then ' we found it
' parse out the dollar value of the balance
sBalance = tag.innerText
sBalance = Right(sBalance, Len(sBalance) - InStr(sBalance, "$") - Len("$") + 1) ' search forward to just past the dollar sign
sBalance = Left(sBalance, InStr(sBalance, "*") - 1) ' snip off everything after the cents
sBalance = Left(sBalance, Len(sBalance) - 4) & "." & Right(sBalance, 2) ' replace weird symbol with decimal point
' MsgBox sBalance
Range("AmazonStoreCardBalance") = sBalance ' copy the dollar amount into the proper cell of the spreadsheet
Exit For
End If
Next tag
Set HTMLDoc = Nothing
FlashRange Range("AmazonGiftCardBalance"), 4
WAVPlay (SoundFileFolder + "qopen2.wav")
Err_Clear: ' this code apparently lets us ignore random insignificant errors that often occur
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
@@@@@@@@@@@@@@@@@@@@ HTML code snippet I've been working with @@@@@@@@@@@@@@@@@@@
<label for="loginUserID" class="labelMargin loginLabel">
User ID
</label>

<input name="userName" maxlength="50" value="" id="loginUserID" class="fullWidth ensightenEvent" aria-describedby="loginUserIDdes loginUserIDdes1" data-type="field" data-reason="login" type="text">
Case-sensitive, may differ from your Amazon.com User ID
<label for="loginPassword" class="labelMargin loginLabel">
Password
</label>

<input name="password" maxlength="20" id="loginPassword" class="fullWidth ensightenEvent" aria-describedby="loginPassworddes" data-type="field" data-reason="password" type="password">
<input class="customInput ensightenEvent" id="rememUID" aria-describedby="rememUIDdes" *******="javascript:setRememberMeFlag(this.id);" data-reason="login:start:remember user id" data-type="field" type="checkbox">
<label for="rememUID" class="pull-left rememberme" id="rememUIDdes">Remember User ID</label>
<a href="javascript<strong></strong>:loginSubmit('../Login/loginSubmit.action', 'loginForm');" title="Login to your account" id="secLoginBtn" data-reason="login:start:submit" data-type="button"
class="btn secLoginBtn secureLockImg ensightenEvent">

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@