Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Filling a form on a website with information from excel

Posted on 2003-03-15
Medium Priority
Last Modified: 2010-05-03

I hope to be write a program to fill a form on the internet with information from an excel spreadsheet. For example, there is a website where u have a personal account. You can access the account manually to input the information in the excel spreadsheet into the various fields of a form. I would like to find out how can i go about doing this automatically. I would really appreciate it if someone can provide me with some directions on how i can go about doing this.

Question by:Charlemagne_
  • 4
  • 3

Expert Comment

ID: 8141835
'Make a reference to Microsoft Internet controls

Dim WithEvents IE As InternetExplorer
Private Sub Form_Load()
Set IE = New InternetExplorer
With IE
     .Navigate "www.hotmail.com" ' The URL
     .Visible = True
End With
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is IE) Then
 'Replace with appropriate text
    If InStr(1, URL, "passport.com/cgi-bin/login", vbTextCompare) Then
            Dim inp As Object
            Set inp = IE.Document.All.Item("login")
            inp.Value = "username"  'replace with your id
            Set inp = IE.Document.All.Item("passwd")
            inp.Value = "password"  'replace with your password
            Set inp = IE.Document.All.Item("enter")
     End If
End If
End Sub


Author Comment

ID: 8142753
Is there any website where i can find more information on it?

What happens if i wish to follow through a link? on the site that can only be access through clicking... any ideas?


Author Comment

ID: 8146322
I tried the code you posted... but it doesnt seem to work... i can open the url, but i am not able to proceed with entering my information. Can you help me out with this? thanks
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8146519
Each Web Page is different. Look at the codesource of your url and search for "input type" to determine the names of the controls you want to fill.
Example :
<input type="password" name="passwd" maxlength="16" class="PPRField" size="25" tabindex="2" autocomplete="OFF">

The name of this control is "passwd" and it is an array.
So I think you would have to modify the code like this:

Set inp = IE.Document.All.Item("passwd")(2)
inp.Value = "mypassword"  'replace with your password

Author Comment

ID: 8272812
Sorry for the late reply... but i was wondering if there is anywhere i can read up on the IE object library?

Accepted Solution

DocM earned 200 total points
ID: 8273944

Author Comment

ID: 8338199
Hi DocM,

I tried the code u posted. I placed the form load in a module, the IE_DocumentComplete and the withevents declaration in a class module. I have also made the reference to the internet controls.

However, the code does not run.... do u think u can help me out?
Many thanks!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question