![]() |
How to refer to an ActiveX Control itself in event handler?
Hello,
In the event handler function for a button, how do I refer to the control itself? I tried "Me" but found out it refers to the active worksheet. I know I can get it by using ActiveSheet.OLEObjects("btn_RESET"), but was wondering if there is an easier way. Private Sub btn_RESET_Click() End Sub Thanks. |
How to refer to an ActiveX Control itself in event handler?
Try this,
'------------------------------- Private Sub btn_RESET_Click() Dim Btn As Object, Message As String Set Btn = Shapes("CommandButton1").OLEFormat.Object.Object Message = "Type of control : " & TypeName(Btn) & vbCrLf & _ "Caption : " & Btn.Caption MsgBox Message End Sub '------------------------------- a écrit dans le message de groupe de discussion : ... Hello, In the event handler function for a button, how do I refer to the control itself? I tried "Me" but found out it refers to the active worksheet. I know I can get it by using ActiveSheet.OLEObjects("btn_RESET"), but was wondering if there is an easier way. Private Sub btn_RESET_Click() End Sub Thanks. |
How to refer to an ActiveX Control itself in event handler?
Me.btn_RESET.Caption = "kf9150" -- Jim Cone Portland, Oregon USA wrote in message Hello, In the event handler function for a button, how do I refer to the control itself? I tried "Me" but found out it refers to the active worksheet. I know I can get it by using ActiveSheet.OLEObjects("btn_RESET"), but was wondering if there is an easier way. Private Sub btn_RESET_Click() End Sub Thanks. |
All times are GMT +1. The time now is 05:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com