I am trying to simulate a combination lock as part of an escape room power point. On one particular slide there are 4 text boxes. The user can click any text-box to increment the number in that particular text box. The VBA code is the same for all four text boxes so I'd like to just write it once (for easy maintenance) because the behavior is exactly the same for each "Dial". BUT it looks like macros can not use a parameter list so I can't give the macro an index (or tag) as to which of the text-boxes the user clicked (the sub name doesn't show up in the macro list if there is a anything in the brackets of the sub). I guess I could just copy and paste the code four times, change the macro name and set the action to a specific copy - but surely there is a better way?

Thank you in advance - this is a real challenge for me.

The code below:
I've named the text boxes 0, 1, 2, 3. There is also a Reset button, to reset the lock to: 0 0 0 0. And a star that turns green if the correct combination is in the text boxes.
And all the commented out code are futile attempts at discovering the index or name of the specific text box that triggered the macro.

LOCK1 is a workaround: If I happen to insert a new slide in front of this "combo lock" slide, the combo lock slide gets a new slide number then the macros are useless. I would like to use the macro for any slide, but one problem at a time I suppose.


Const LOCK1 As Integer = 1 ' slide index for combination lock
Dim D(4) As Integer 'combination dials




Sub SpinDial()
    Dim shpDial As Shape
    Dim i As Integer
    Dim Test As Boolean
    
    MsgBox "Spin dial"
    
    'set shpDial = ActiveWindow.Selection.ShapeRange(1)
    'Set shpDial = ActivePresentation.Slides(LOCK1).Shapes.Range.Id
    'shpDial = ActivePresentation.Slides(LOCK1).Shapes
    
    i = CInt(shpDial.Name)
    MsgBox "shape name: " & i
    
    'D(i) = (D(i) + 1) Mod 10
    'MsgBox "D(" & CStr(i) & ") = " & CInt(D(i))
    
    'ActivePresentation.Slides(LOCK1).Shapes(shpDial.Name).TextFrame.TextRange.Text = D(i)
    'MsgBox "check combo..."
    
    'CheckCombo
    'MsgBox "returned from check combo"


End Sub


Sub Reset()
    Dim i As Integer
    For i = 0 To 3
        D(i) = 0
        ActivePresentation.Slides(LOCK1).Shapes(CStr(i)).TextFrame.TextRange.Text = D(i)
    Next i
    ActivePresentation.Slides(LOCK1).Shapes("Star").Fill.ForeColor.RGB = vbRed


End Sub


Function CheckCombo() As Boolean
    
    If D(0) = 8 And D(1) = 3 And D(2) = 6 And D(3) = 2 Then
        ActivePresentation.Slides(LOCK1).Shapes("Star").Fill.ForeColor.RGB = vbGreen
    Else
        ActivePresentation.Slides(LOCK1).Shapes("Star").Fill.ForeColor.RGB = vbRed
    End If