I'm not 100% sure I understand exactly what you are trying to achieve, but as
far as I have ever seen, there is no way to use a Mouse event on a worksheet,
only on user forms. If I were doing what I think you are trying to do, I
would activate macro2 using the RightClick or DoubleCLick event, which WILL
work on a worksheet.
I would restrict the operation of the event procedure to a particular cell
or group of cells (using the "Target" parameter in the event) and use "Cancel
= True" so that the normal default right-click event would not also occur.
You could put the desired code in the Event procedure itself or have it call
the code from a separate Sub.
In the cell(s) that you want to use as a trigger, you could put some text
like "Run Text Procedure (R-Click)" as a visual cue. Exactly how or whether
you do that would depend on whether other people are going to be using your
app and (therefore) whether a visual cue is necessary.
I do a lot of this "event driven" stuff in apps that are used by 50 or 60
people who have varying levels of IT savvy. You need to put a lot of thought
into it, mainly on two grounds (1) You have to provide a strong intuitive
interface for the less IT-savvy people without treating the "ITsmart" people
like dummies (2) Sheet events add layers of complexity to the whole project
and can have unintended consequences which then need solutions that require
another level of complexity. But the event-driven app can be extremely
"smart" and user-friendly if you get it right and stay on top of the
complexities.
--
Time is just the thing that keeps everything from happening all at once
"kalle" wrote:
Thanks for your answer.
You say that mouse events only works in userforms but if I insert a
control in a worksheet? Does a control have the same mouse evnts in a
worksheet?
I use userforms in this project but it should be nice if I can use a
mouse event in one of my worksheets.
I need something transparent that start a event macro. I try to insert
label by code but I can't set it to transparet. If that is possible that
should solve my problem.
Regards
Kalle
*** Sent via Developersdex http://www.developersdex.com ***