Southerncentralrain
Board Regular
- Joined
- Jul 6, 2008
- Messages
- 115
I am trying to login to a website using VBA but I can't get it to click the submit button even though I do the things that I have found recommended. Any help would be greatly appreciated.
Below is the HTML of the form:
Here is the VBA that I have tried and it fills in the name and password but will not submit even through it runs the code without error.
Any ideas? Thanks in advance for your time.
Below is the HTML of the form:
HTML:
<div class="pdForm login">
<div class="pdLoginBox"> <div class="pdLoginBoxInner">
<div class="pdLoginFieldTitle"> <div>Email Address</div> <div class="register"></div> </div> <input type="email" name="email" value="" class="pdInput text" id="pdLogin-email">
<br> <div class="pdLoginFieldTitle"> <div>Password</div> <div class="forgot"><a href="http://myaccount.asdf.com/retrievePassword.php" *******="pdRetrievePasswordCopyEmail(this);"> Forgot your Password?</a></div> </div> <input type="password" name="password" value="" class="pdInput text" id="pdLogin-password">
<div class="pdLoginBtn"> <input type="image" src="http://myaccount.asdf.com/skins/standard_custom/butLogin.gif" border="0" vspace="4"> </div> <div class="pdRegisterBtn"> </div>
</div> </div> </div>
Here is the VBA that I have tried and it fills in the name and password but will not submit even through it runs the code without error.
Code:
[COLOR=#222222][FONT=Verdana]Sub Login()[/FONT][/COLOR][/FONT][/COLOR]
Set IE = CreateObject("InternetExplorer.Application")
my_url = "http://myaccount.asdf.com/login.php"
With IE
.Visible = True
.Navigate my_url
.Top = 50
.Left = 530
.Height = 1200
.Width = 1200
Do Until Not IE.Busy And IE.READYSTATE = 4
DoEvents
Loop
End With
' Input the userid and password
IE.Document.GetElementById("pdLogin-email").Value = "asdf@asdf.com"
IE.Document.GetElementById("pdLogin-password").Value = "xxxxxx"
Set ElementCol = IE.Document.getElementsByClassName("pdLoginBtn")
For Each btnInput In ElementCol
btnInput.Click
Next btnInput
[COLOR=#242729][FONT=Arial][COLOR=#222222][FONT=Verdana]End Sub[/FONT][/COLOR][/FONT][/COLOR]
Any ideas? Thanks in advance for your time.