Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi! I have this code and it works but it should be nice if the macro2 could run with an onmouseover event. Is this possible? If it is, is it also possible to get the old text with somthing like onmouse out? Sub Macro3() ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 346.5, 105#, _ 100.5, 63#).Select Selection.Characters.Text = "Text" Selection.Name = "MyTextBox" Selection.OnAction = "Macro2" 'insert new text End Sub Sub Macro2() ActiveSheet.Shapes("MyTextBox").Select Selection.Characters.Text = "New Text" Range("F20").Select End Sub Thanks in advance *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The various "built in" mouse events are only coded to work with objects that
are on a User Form (as distinct from objects drawn on a worksheet). User forms are good fun and very functional and they give your application a professional look, which can be handy if other people are using it. Worth considering ..... -- "I've played in front of many talented audiences" "Kalle" wrote: Hi! I have this code and it works but it should be nice if the macro2 could run with an onmouseover event. Is this possible? If it is, is it also possible to get the old text with somthing like onmouse out? Sub Macro3() ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 346.5, 105#, _ 100.5, 63#).Select Selection.Characters.Text = "Text" Selection.Name = "MyTextBox" Selection.OnAction = "Macro2" 'insert new text End Sub Sub Macro2() ActiveSheet.Shapes("MyTextBox").Select Selection.Characters.Text = "New Text" Range("F20").Select End Sub Thanks in advance *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 *** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
apply cell change event to single column - WorksheetChange Event | Excel Programming | |||
Click event on menu item is lost after first time firing of the event | Excel Programming | |||
onMouseOver Highlight Rows | Excel Programming | |||
How to trap delete row event and hide column event? | Excel Programming | |||
user form-on open event? keydown event? | Excel Programming |