folks,

good day to all.

I am stuck on a command button class macro.

My word document has like 20 command buttons, they all have basic properties which are the same such as the caption, font color etc.

I thought I may be able to put it in a class. but that's not working out very well

Code:
Option Explicit

Public WithEvents myButtonGroup As CommandButton

Private Sub myButtonGroup_Click()


    With myButtonGroup
         
        If   .Caption = "Click" Then
             .ForeColor = 16777200        
          
        Else
            .BackColor = 60928         
            .Caption = "Executed"
        End If
    End With
    
    
End Sub

Also on a side note does anybody have any idea how i can programmatically align the command buttons to center on each table cell - manually its a pain in the wrist pun intended.
I put the buttons in a table - some are aligned top, some bottom - I want them centered.

button.png


thanks for any ideas folks

pb