ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   active control box name on worksheet (https://www.excelbanter.com/excel-programming/442992-active-control-box-name-worksheet.html)

pjbur2005 via OfficeKB.com

active control box name on worksheet
 
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.a...mming/201006/1


Jim Cone[_2_]

active control box name on worksheet
 
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
--
Message posted via OfficeKB.com



All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com