Internet Explorer VBA Automation

VBAlearner5

New Member
Joined
Jan 25, 2015
Messages
4
Hi,

I am trying to open a website and log into it using VBA.
The probelm I run into is that the username and password are only filled in "superficially". Hence when the VBA code clicks the login button it asks me to enter a username and password. When I click into the username and password fields after having executed the code, they turn empty.

I therefore tried to let the VBA code "click" into the fields first before entering the values. But this did not help either (most probably because I did it incorrectly).

I am executing this code in IE 11, in case this is relevant.

I would highly appeciate any comments and help.

Thank you in advance!


This is the VBA code:

Code:
    Dim ie As Object    
    Set ie = CreateObject("InternetExplorer.Application")
     
    ie.navigate "https://www.ups.com/uis/create?loc=de_DE"
    ie.Visible = True
     
    Do While ie.Busy
    Loop
   
    ie.Document.getElementById("userIdInput").Click
    ie.Document.getElementById("userIdInput").Value = "XXX"
    ie.Document.getElementById("passwordInput").Click
    ie.Document.getElementById("passwordInput").Value = "XXX"
    ie.Document.getElementById("loginButton").Click


This is the relevant part of the source code:

HTML:
<input type="text" class="reqTxtInst" maxlength="16" value="Benutzer-ID" id="userIdInput" name="userId"/>
<span style="position:relative">
<label id="passwordlabel" for="password" class="reqTxtInst" style="position:absolute; top:0; left:0">Kennwort</label>
<input type="password" class="reqTxtInst" maxlength="26" id="passwordInput" value="" name="password" onkeydown="if (event.keyCode == 13) document.getElementById('loginButton').click()" autocomplete="off"/>
<input type="button" class="btnArw colPad" value="Anmelden" id="loginButton" *******="login()" />  <input type="submit" style="display:none" *******="login()" />
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,215,067
Messages
6,122,949
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top