PDA

View Full Version : [SOLVED:] Object Required error



kbsudhir
11-29-2007, 03:59 PM
Hello.

Iam using the below code to automatically click a button on a web page.

IE1.document.logon0.submit.Click

Here

IE1 - Object of the internet explorer in which the webpage is open.
logon0 - form name in which the button is situated
submit - button name
click - initating button click.

The button is getting clicked and the webpage is also logging in.

But as soon as this code is executed I am also getting this error -

Run-Time error '424':
Object required.

I wnat to know what object is it asking for..???? as the code is clicking button correctly.


Sudhir

:dunno

Simon Lloyd
11-29-2007, 05:16 PM
Sudhir, you usually get error 424 when excel cannot find the object, that is to say that somewhere in your code you have a reference to a userform, worksheet, range etc that may have the name wrong in one of your modules...if you have nothing else then maybe its because the web button you click no longer exists with that name after its been clicked!

kbsudhir
11-30-2007, 08:45 AM
Yes, I think you are right. After clicking the button the new doesn't have that button.

So what is the solution for this.

Thanks for your time
Sudhir

Simon Lloyd
12-01-2007, 09:36 AM
you need to add some error handling! or use the blanket error handling On Error Resume Nextbut beware this ignores all errors!

Norie
12-01-2007, 10:33 AM
Sudhir

Can we see the rest of the code?

Simon

That won't solve the problem since, as you say, it hides all errors.

kbsudhir
12-03-2007, 01:26 PM
Private Sub Extract_Click()
'FormatPO
'ChkRep
Dim IE1 As InternetExplorer
Set IE1 = CreateObject("InternetExplorer.Application")
IE1.Visible = True
IE1.navigate "Insert The URL Of The Desired Website Here"
Do
If IE1.readyState = 4 Then
Exit Do
Else
DoEvents
End If
Loop
Application.Wait (Now + TimeValue("0:00:03"))
IE1.document.logon1.i_1.Value = "Insert The User Name"
IE1.document.logon2.i_2.Value = "Insert The password"
'Here "logon1/logon2"is the form name where respective control is situated.
'here "i_1/'_2" is the name of text fied accepting the user id and password respectively.
'Application.Wait (Now + TimeValue("0:00:03"))
'The below code line will click the submit(login) button."Submit" is the name of the button
IE1.document.logon0.submit.Click
End Sub

Simon I am not able to provide the link as it is confidential.
But this is the code I am using.

Provide the refernces of "HTML Object Library" and "Internet Controls"


Thanks for the help.

Sudhir