Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to popup a shortcut menu whenever a user right clicks in a textbox on
my userform. I initially tried to use: ctrl = Screen.Activecontrol 'this is how I would do it in Access but this did not work. Since I have several userforms, and I want this subroutine to work for each of them, I tried declaring the control in the subroutines declaration statement: Public Sub EditMenuPopup(ctrl as Textbox) Unfortunately, with this approach, I encountered two problems. When I called the sub using: Call EditMenuPopup(me.txt_SomeControl) I got an error because it was trying to pass the value of the control, not the actual control. When I tried: Call EditMenuPopup(me.ActiveControl) I got a type mismatch because it believes that the active control is a multipage control, not the textbox that actually has the focus. In some forms, the textbox might be on a multipage (tab) control, in others it will just be on the main form, and this would probably work. I thought about passing the userform and control names but don't know how to refer to refer to the form with its name. In Access I would use: Forms(strFormName) Any ideas how to work approach this issue would be greatly appreciated Dale -- Don''t forget to rate the post if it was helpful! email address is invalid Please reply to newsgroup only. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pass array of sheet names to subroutine | Excel Programming | |||
Control Click Subroutine (BHatMJ) | Excel Programming | |||
Function parameters: trying to pass a control | Excel Programming | |||
Pass a Variable List Of Values To Subroutine or Function | Excel Programming | |||
How to pass a workshhet name as a parameter into a subroutine ? | Excel Discussion (Misc queries) |