FootBallBat
Board Regular
- Joined
- Jan 26, 2012
- Messages
- 169
Here is my code to create a clickable button.
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=96.7, Top:=341.25, Width:=100, Height:= _
55).Select
ActiveSheet.OLEObjects(1).Object.Caption = "YES"
ActiveSheet.OLEObjects(1).Object.BackColor = &HFF0000
ActiveSheet.OLEObjects(1).Object.ForeColor = 49152
With Selection
.Name = "YES"
.Object.Caption = "YES"
End With
Now when I go to attach a macro to the button this is what I get.
Private Sub CommandButton1_Click()
End Sub
What Im wondering is, is it possible to change the "CommandButton1" to "YesButton?
The problem I'm having is the "YES" button may not be the first button I add so I would like to have a set name for it.
Thank you
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=96.7, Top:=341.25, Width:=100, Height:= _
55).Select
ActiveSheet.OLEObjects(1).Object.Caption = "YES"
ActiveSheet.OLEObjects(1).Object.BackColor = &HFF0000
ActiveSheet.OLEObjects(1).Object.ForeColor = 49152
With Selection
.Name = "YES"
.Object.Caption = "YES"
End With
Now when I go to attach a macro to the button this is what I get.
Private Sub CommandButton1_Click()
End Sub
What Im wondering is, is it possible to change the "CommandButton1" to "YesButton?
The problem I'm having is the "YES" button may not be the first button I add so I would like to have a set name for it.
Thank you