Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't trap "Runtime error 424: Object required" error 1

Status
Not open for further replies.

JasGrand

Programmer
Jan 8, 2003
144
CA
Hello, for some reason i can't trap the "Runtime error 424: Object required" error... any other error goes to my error handler... but that one just pops up a msgbox with "Runtime error 424: Object required" and i have to click the "End" button. Any help is appreciated.

Thanks,


Jason
 
Can you step through the code? Are you sure all of your procedures have an error handler? If nothing else, you can insert debug statements everywhere in your code to attempt to trace the problem.
 
yeah i got the error handlers on the page with the delete button, and then also in the code module that it calls. how do we do the debug statements?

Thanks,


Jason
 
You can use debug.print <string> in the area of your code where you think the error is being raised, then check the immediate window after the error occurs. You might have to insert additional debug statements to home in on the error.

debug.print "call format function"
call FormatPhone(strPhoneNum)

(more code)

debug.print "log user activity"
call LogActivity

If you see "call format function" in the immediate window but not "log user activity" then you'll know the error occurred between those events.
 
the error occurs at the point where i'm deleting the sheet in the following code:


'// Delete Active Sheet
ThisWorkbook.Sheets("Page " & varInput).Delete

this error only happens when a user selects something from the dropdown box on the sheet... works fine if they just delete a blank page.


Thanks,


Jason
 
I don't understand the interface here. What's the dropdown for? Does it populate varInput?

If you truly want to delete the active sheet, try ActiveSheet.Delete -
 
Anyway you can't delete a sheet if the workbokk has only one.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hello, sorry for the wait. The dropdowns are for the client info... they only want to input client info once... and this excel sheet isn't connected to a database... so i copy the client info they enter to a sheet called "CLIENTINFO" which is hidden. Anyways, i figured out a way around whatever the problem was... i removed all the items from the dropdown boxes then i was able to delete the page... dunno why it wasn't working before... but it is now.

Btw, do you know of any way to add a variable so that i don't have to do a single line for every combobox to the following lines:

ThisWorkBook.Sheets("Page 2").Combobox1.clear
ThisWorkBook.Sheets("Page 2").Combobox2.clear
ThisWorkBook.Sheets("Page 2").Combobox3.clear
ThisWorkBook.Sheets("Page 2").Combobox4.clear
etc...

ex.. something like ThisWorkBook.Sheets("Page 2").Combobox & Variable.clear

i can see why this won't work... but there has to be an easier/different way to do this?

Thanks for all the help,


Jason
 
From Help:

For a Controls collection, Clear deletes controls that were created at run time with the Add method. Using Clear on controls created at design time causes an error.

If the control is bound to data, the Clear method fails.


Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top