nicolasnam
New Member
- Joined
- Feb 21, 2018
- Messages
- 3
Hi,
I'm looking for someway to implement the 'OnAction' command which only exists for the normal form control button into the following ActiveX Command Button.
Dim qb As Object 'Quit game button
Dim qbr As Range
Set qbr = ActiveSheet.Range("K14:K15")
Set qb = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Left:=qbr.Left, Top:=qbr.Top, Width:=qbr.Width, Height:=qbr.Height)
With qb
.Object.Caption = "Quit"
.Object.BackColor = RGB(244, 176, 132)
.OnAction = "end_game"
End With
P.S. This is my first day using VBA.
I'm looking for someway to implement the 'OnAction' command which only exists for the normal form control button into the following ActiveX Command Button.
Dim qb As Object 'Quit game button
Dim qbr As Range
Set qbr = ActiveSheet.Range("K14:K15")
Set qb = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Left:=qbr.Left, Top:=qbr.Top, Width:=qbr.Width, Height:=qbr.Height)
With qb
.Object.Caption = "Quit"
.Object.BackColor = RGB(244, 176, 132)
.OnAction = "end_game"
End With
P.S. This is my first day using VBA.