We help IT Professionals succeed at work.

Auto fill web forms using VBA

Last Modified: 2013-11-27
I need to be able to go to a website and have VBA automatically enter the Login, Password and client code (all of which I have) and move to the next page.

The following code  navigates there correctly but I have been unable to  fill in the fields either directly or with send keys.

    Set ieApp = CreateObject("InternetExplorer.Application")
    ieApp.Visible = True
    ieApp.Navigate "https://ecf.ganb.uscourts.gov/cgi-bin/show_case_doc?28,349918,,19383973,"

Any ideas would be greatly appreciated.
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)



Your code works like a charm.  If I can push my luck on the second page (after the login) there is a single button to verify that you wish to enter the system.

The HTML for the page is:

<HTML><HEAD><link rel ="stylesheet" type="text/css" href="/styles/default.css">
<TITLE>TestSystemName</TITLE></HEAD><BODY BGCOLOR=F9F9F9 TEXT=000000 onLoad='SetFocus()'><SCRIPT LANGUAGE="JavaScript">
            var IsForm = false;
            var FirstField;
            function SetFocus() {
                  if(IsForm) {
                        if(FirstField) {
                              var ind = FirstField.indexOf('document.',0);
                              if(ind == 0)
                                    var Code = "document.forms[0]."+FirstField+".focus();";
                        } else {
                              var Cnt = 0;                        
                              while(document.forms[0].elements[Cnt] != null) {
                                    if(document.forms[0].elements[Cnt].type != "hidden") {
                                    Cnt += 1;
<!-ShowPage(GENERICCDISPLAY)-> <P>To accept charges shown below, click on the 'View Document' button, otherwise click the 'Back' button on your browser.</P><FORM ENCTYPE='multipart/form-data' method=POST ACTION="/cgi-bin/show_case_doc?28,349918,,19383973,,1"><HR><CENTER><TABLE BORDER=1 BGCOLOR=white width="400"><TR><TH COLSPAN=4><FONT SIZE=+1 COLOR=DARKRED>Pacer Service Center </FONT></TH></TR><TR><TH COLSPAN=4><FONT COLOR=DARKBLUE>Transaction Receipt </FONT></TH></TR><TR></TR><TR></TR><TR><TD COLSPAN=4 ALIGN=CENTER><FONT SIZE=-1 COLOR=DARKBLUE>Thu Oct 11 09:47:32 EDT 2007</FONT></TD></TR><TR><TH ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> Pacer Login: </FONT></TH><TD ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> cw0133 </FONT></TH></TD><TH ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> Client Code: </FONT></TH><TD ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> system                           </FONT></TD></TR><TR><TH ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> Description: </FONT></TH><TD ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> Image28-0 </FONT></TD><TH ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> Case Number: </FONT></TH><TD ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> 05-71193-pwb </FONT></TD></TR><TR><TH ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> Billable Pages: </FONT></TH><TD ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> 2 </FONT></TD><TH ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> Cost: </FONT></TH><TD ALIGN=LEFT><FONT SIZE=-1 COLOR=DARKBLUE> 0.16 </FONT></TD></TR><TR></TR><TR></TR></TABLE></CENTER></HR><INPUT type=submit Value="View Document"></FORM>

Can I get the system to automatically click that button as well?


Ended up using


to submit the second page
Is there any way to change list box containts & require event shold fire. Because in some web page it will display content of second list box only after fist list box value has selected and just passing value is not working.
E.g. After Selecting State in List Box of State the wab Page fill list of city in List Box of City and if we just change value of state using iePage.Forms(0).Item("State").Value = "STATENAME" then it is not filling city detail.
Is there any way to fire require event after filling details.

Sanjay Shah

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.