From: pjbur2005 via OfficeKB.com on
Hi

i have tried to find the answer to this,

I ahve used a control box command button and want to determine its name from
code so i can use this elsewhere. i know application.caller does not work

Private Sub ToggleMonth1_Click()
Dim CtrlName As String
With Worksheets("DP + SDS")
ctrlname = ? 'help it should be toggleMonth1

End With


End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/excel-programming/201006/1

From: Jim Cone on
In a standard module, declare a public string variable (one line at the top)
Public strCtlName as String

In the Sheet module...
Private Sub ToggleMonth1_Click()
strCtlName = Me.ToggleMonth1.Name
'other code
End Sub
--
Jim Cone
Portland, Oregon USA
Review of Special Sort add-in...
http://www.contextures.com/excel-sort-addin.html






"pjbur2005 via OfficeKB.com" <u18722(a)uwe>
wrote in message
Hi
i have tried to find the answer to this,
I ahve used a control box command button and want to determine its name from
code so i can use this elsewhere. i know application.caller does not work

Private Sub ToggleMonth1_Click()
Dim CtrlName As String
With Worksheets("DP + SDS")
ctrlname = ? 'help it should be toggleMonth1
End With
End Sub
--
Message posted via OfficeKB.com

 | 
Pages: 1
Prev: Just a test
Next: Sheet codename not working