Link to home
Start Free TrialLog in
Avatar of Charlemagne_
Charlemagne_

asked on

Filling a form on a website with information from excel

Hi!

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.

Thanks,
Kai
Avatar of DocM
DocM

'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")
            inp.Click
     End If
End If
End Sub
 

Avatar of Charlemagne_

ASKER

Hi!
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?

Thanks
Hi!
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
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
Hi!
Sorry for the late reply... but i was wondering if there is anywhere i can read up on the IE object library?
ASKER CERTIFIED SOLUTION
Avatar of DocM
DocM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!