Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have multiple text box - in the mouse down event for each - I want to pass
the name of the textboax to another module something like this public controlname as control sub mousedown() controlname = activesheet.control.name What is the correct code? Also the mouse down event seems to happen twice upon one right click - anyway to stop this - thanks so much for your help! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your mousedown event should look like this
Private Sub TextBox1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) End Sub The name is typically "TextBox1". In some (untypical) scenarios the shape name can be different to the OLEObject name, if you prefer that use TextBox1.Name Yes the mousedown event does run twice (I've discussed this before in this ng). Are you sure GotFocus isn't a more appropriate event, otherwise MouseUp. If you really need mousedown try something like this - Static nEvnt As Long If Button = 2 Then nEvnt = nEvnt + 1 If nEvnt < 2 Then Exit Sub End If End If nEvnt = 0 Regards, Peter T "Kenny" wrote in message ... I have multiple text box - in the mouse down event for each - I want to pass the name of the textboax to another module something like this public controlname as control sub mousedown() controlname = activesheet.control.name What is the correct code? Also the mouse down event seems to happen twice upon one right click - anyway to stop this - thanks so much for your help! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Peter thanks so much for your help. I wrote this mouse down (right click)
event that will fire another module and carry the objects name in a variable with it. Im going to copy the same code to each of the mouse down events for all textbox's on the sheet. The problem is I have to change "set popobject = TextBox1" to the objects name in every mouse down event. Is there a way to give the variable the object's name of which ever objects mousedown event I am in. Such as "set popobject = Selected.Objects.Name" or something to that effect. "Peter T" wrote: Your mousedown event should look like this Private Sub TextBox1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, _ ByVal X As Single, ByVal Y As Single) End Sub The name is typically "TextBox1". In some (untypical) scenarios the shape name can be different to the OLEObject name, if you prefer that use TextBox1.Name Yes the mousedown event does run twice (I've discussed this before in this ng). Are you sure GotFocus isn't a more appropriate event, otherwise MouseUp. If you really need mousedown try something like this - Static nEvnt As Long If Button = 2 Then nEvnt = nEvnt + 1 If nEvnt < 2 Then Exit Sub End If End If nEvnt = 0 Regards, Peter T "Kenny" wrote in message ... I have multiple text box - in the mouse down event for each - I want to pass the name of the textboax to another module something like this public controlname as control sub mousedown() controlname = activesheet.control.name What is the correct code? Also the mouse down event seems to happen twice upon one right click - anyway to stop this - thanks so much for your help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
pass to textbox on a form and to excel worksheet | New Users to Excel | |||
OnTime: Pass Object Arguments | Excel Programming | |||
Pass a range object as a parameter | Excel Programming | |||
Pass object by value not working... | Excel Programming | |||
How to pass active workbook to external DLL? | Excel Programming |