Picture15_Click( ) vs. CommandButton1_Click( )


Posted by Rick M on July 11, 2001 3:16 PM

I have code written for an event to happen when CommandButton1 is clicked...It works fine.
When I try to assign the same code to a pictureClick I always get Run-Time error '424'; Object required.
Why won't the code work on a picture?
Thanks...

Posted by Damien on July 11, 2001 4:26 PM

Use the same code but use a activex control button. Double click it and put you code there if you look at the properties there is a picture field and then chose the directory and file i use this method alot private subs can be a pain but.



Posted by Damon Ostrander on July 11, 2001 11:01 PM

Rick,

The code that you assign to a graphic (Shape object, Chart object, etc.) must be in a macro module (the place where code goes in Excel's Recode mode), not in the worksheet's event code area. Put the code there, name the routine anything you want (it doesn't have to be Picture15_Click), then right-click on the picture and select Assign Macro...

Happy computing.

Damon