Hi guys,
Im trying to figure out how to have excel login to a particular website via VBA. Currently the code I have works for other websites but this particular site has username/password field types as 'hidden' which I believe is the issue. Here is some of the code I currently have that is working:
Here is the website inspect element that I am having issues getting the code to work with:
User Name:
Password:
Sign-In Button:
I have tried changing the username.value and password.value to something like this but still doesn't work:
Any help would be appreciated. Thanks.
Im trying to figure out how to have excel login to a particular website via VBA. Currently the code I have works for other websites but this particular site has username/password field types as 'hidden' which I believe is the issue. Here is some of the code I currently have that is working:
Code:
Sub Login ()
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Dim clip As DataObject
Set ieApp = New InternetExplorer
ieApp.Visible = True
ieApp.Navigate "ANY WEBSITE URL"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.Document
With ieDoc.forms(1)
.UserName.Value = "12345"
.Password.Value = "ABCD"
.submit
End With
ieApp.Quit
Set ieApp = Nothing
End Sub
Here is the website inspect element that I am having issues getting the code to work with:
User Name:
Code:
input name="usernameDisplay" style="width: 90px;" onkeypress="return submitenter(event)" type="text" maxlength="50" value=" "
input name="username" type="hidden"
Password:
Code:
input name="password" style="width: 90px;" onkeypress="return submitenter(event)" onfocus="this.select()" type="password" maxlength="50"
input name="login-form-type" type="hidden" value="pwd"
Sign-In Button:
Code:
img id="view:_id10" style="border: currentColor; border-image: none;" src="/images/en/signinbutton.gif"
I have tried changing the username.value and password.value to something like this but still doesn't work:
Code:
ieApp.Document.getElementById ("input type='text' name='usernameDisplay value=' ' ")
Application.SendKeys "12345"
ieApp.Document.getElementById("input type='password' name='password'").Click
Application.SendKeys "ABCD"
ieApp.Document.getElementById("view:_id10").Click
Any help would be appreciated. Thanks.