Solved

Automating IE with Excel VBa

Posted on 2010-11-19
6
358 Views
Last Modified: 2012-06-22
I have the following code for the webpage (which is in the code). When I use it I get the Run time error 438 (Object doesn't support this property method) highlighting the IE.Document.getElementsByName("CustID").Value = "Username1".

I would like the username to be entered automatically and continue button next to the username box to be clicked automatically.

How can I achieve this?

Sub aa2()

Dim IE As Object
  
  Set IE = CreateObject("InternetExplorer.Application")
  
  IE.Visible = True
  IE.Navigate "www2.netxpro.com"
  ' Wait for the page to load.
  Do While IE.Busy Or IE.ReadyState <> 4
    DoEvents
  Loop
  
  IE.Document.getElementsByName("CustID").Value = "Username1"

End Sub

Open in new window

0
Comment
Question by:awesomejohn19
  • 3
  • 3
6 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34175142
Replace this

IE.Navigate "www2.netxpro.com"

with

IE.Navigate "https://www2.netxpro.com/salogin.htm"

and try now
0
 

Author Comment

by:awesomejohn19
ID: 34175164
Thanks for your response. II get the same error
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34175177
How dumb of me...

Try this and it will work....

Sub Sample()
    Dim IE As Object
  
    Set IE = CreateObject("InternetExplorer.Application")
  
    IE.Visible = True
    
    IE.Navigate "https://www2.netxpro.com/salogin.htm"
    ' Wait for the page to load.
    Do While IE.Busy Or IE.ReadyState <> 4
        DoEvents
    Loop
  
    IE.Document.getElementById("CustID").Value = "Username1"

End Sub

Open in new window


forgot to mention about replacing getElementsByName by getElementById lolzzz
0
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!

 

Author Comment

by:awesomejohn19
ID: 34175203
Thanks that works like charm. For the rest of the question, how can I click the continue button.

0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
ID: 34175261
Lolzzz

I saw the question coming...

Sub Sample()
    Dim IE As Object
  
    Set IE = CreateObject("InternetExplorer.Application")
  
    IE.Visible = True
    
    IE.Navigate "https://www2.netxpro.com/salogin.htm"
    ' Wait for the page to load.
    Do While IE.Busy Or IE.ReadyState <> 4
        DoEvents
    Loop
  
    IE.Document.getElementById("CustID").Value = "Username1"
    IE.Document.getElementById("submit").Click
End Sub

Open in new window

0
 

Author Closing Comment

by:awesomejohn19
ID: 34175274
thanks a lot
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pivot table - average if not zero 2 25
Converting time 4 35
Desktop in File-open on Excel 7 30
Script/Formula to move data to another cell 6 16
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

685 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