active control box name on worksheet

  • Thread starter pjbur2005 via OfficeKB.com
  • Start date
P

pjbur2005 via OfficeKB.com

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
 
J

Jim Cone

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@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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top