ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simulate Click Event (https://www.excelbanter.com/excel-programming/331367-simulate-click-event.html)

ben

Simulate Click Event
 
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?
--
When you lose your mind, you free your life.

Tom Ogilvy

Simulate Click Event
 
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.

--
Regards,
Tom Ogilvy


"ben" (remove this if mailing direct) wrote in message
...
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?
--
When you lose your mind, you free your life.




ben

Simulate Click Event
 
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.
--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy


"ben" (remove this if mailing direct) wrote in message
...
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?
--
When you lose your mind, you free your life.





Tom Ogilvy

Simulate Click Event
 
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

--
Regards,
Tom Ogilvy



"ben" (remove this if mailing direct) wrote in message
...
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.
--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy


"ben" (remove this if mailing direct) wrote in

message
...
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?
--
When you lose your mind, you free your life.







ben

Simulate Click Event
 
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
--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy



"ben" (remove this if mailing direct) wrote in message
...
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.
--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy


"ben" (remove this if mailing direct) wrote in

message
...
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?
--
When you lose your mind, you free your life.







ben

Simulate Click Event
 
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?
--
When you lose your mind, you free your life.


"ben" wrote:

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
--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy



"ben" (remove this if mailing direct) wrote in message
...
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.
--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy


"ben" (remove this if mailing direct) wrote in

message
...
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?
--
When you lose your mind, you free your life.








All times are GMT +1. The time now is 04:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com