I have a bit of code I can't get to work.
I have 2 buttons on a custom menu(KRS2005)
Button1 "Archive" and Button2 "Inspection".
I found this piece of code on the net but I can't get it to work.
what am I doing wrong?
I have 2 buttons on a custom menu(KRS2005)
Button1 "Archive" and Button2 "Inspection".
I found this piece of code on the net but I can't get it to work.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim cmdBCtl As CommandBarControl
Set cmdBCtl = Application.commandbars.ActionControl
' Compare the tag to determine which button was clicked.
With cmdBCtl
Select Case .Tag
Case "Archive"
MsgBox "Archief"
Case "Inspection"
MsgBox "Keuringen"
End Select
End With
End Sub
End Sub
what am I doing wrong?