Simulate Click Event

G

Guest

Is there any way to simulate a click event of a Msforms.Label.

This is a label embedded into the worksheet as a shape. When the user clicks
the label, it calls a Class Procedure (there are 108 labels all doing the
same thing.) What I want to do is click one or more labels at a time
programmatically (can't just call the procedure because one i'm calling from
a seperate vba project and that causes headaches, and two i need the name of
the label that i'm clicking and the class procedure passes that argument on
the Click Event.


So can I simulate a click even on an Embedded Msforms.Label?
 
T

Tom Ogilvy

an MSForms.Label embedded on a worksheet has a click event. It is unclear
to me what your question is or why you would need to simulate a click event.
 
G

Guest

Tom,


I need to simulate a click event because, when a user actually clicks
this object it runs code. I want that code to run. And I can not just call
the routine, because it is in a Class Module (there are 108 objects in a
collection that run this code.) They are all in one collection, and in order
for the code to work, i need the name of the label that called the code, and
the click event passes that name into the code as it runs.
 
T

Tom Ogilvy

It is unclear what you have working and what you want to work, but I think
John Walkenbach's sample of how to handle the click event for multiple
commandbuttons is easily adaptable to your situation and using that would
give you a reference to the label that triggered the event.

http://j-walk.com/ss/excel/tips/tip44.htm
Handle Multiple UserForm Buttons With One Subroutine
 
G

Guest

Tom,

Thank You, However I am familuar with that routine that is what is currently
set up in my system to handle this as a user actually moving the mouse and
pressing the button over the label to call the click event. That is not what
I need. I want to know if there is a way, to Call the Class Collection Click
Event while passing the name of the Label to the sub that handles it. (In a
Class module). Therefore I would like to trick excel into thinking the label
was clicked with the mouse....
Ben
 
G

Guest

Tom,
Perhaps this will make it clearer I want to accomplished what is
accomplished by the following.
If a user clicks a CheckBox, it calls that CheckBox_click code
or
if code says "checkbox.value = True" then IT ALSO calls that checkbox_Click
Code
can the same be done with a LABEL?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top