Cronk
Registered User.
- Local time
- Today, 09:06
- Joined
- Jul 4, 2013
- Messages
- 2,799
This is not a question but some code which some others might find useful.
I have been commissioned to upgrade an MDB database, including installing a customized ribbon menu. While I could see the old existing commandbar structure in 'Add-ins', I also needed to know the call back functions.
The following code shows this information. Apologies if this is reinventing an existing wheel but I did not see anything in a search on this site. The output is to the debug window. If any one wants to pretty it up, feel free.
I have been commissioned to upgrade an MDB database, including installing a customized ribbon menu. While I could see the old existing commandbar structure in 'Add-ins', I also needed to know the call back functions.
The following code shows this information. Apologies if this is reinventing an existing wheel but I did not see anything in a search on this site. The output is to the debug window. If any one wants to pretty it up, feel free.
Code:
Sub ListCustomCommandBarControls()
Dim cbr As CommandBar
Dim cbCtl As CommandBarControl, cbCtlA As CommandBarControl
Dim n As Integer
Dim cbar As CommandBar
n = 1
For Each cbr In Application.CommandBars
Debug.Print n, cbr.Name
Next
Set cbar = CommandBars("Lodge")
On Error Resume Next
For Each cbCtl In cbar.Controls
Debug.Print cbCtl.Caption
For Each cbCtlA In cbCtl.Controls
Debug.Print cbCtlA.OnAction, cbCtlA.Caption
If Err <> 0 Then
Debug.Print "Action=?", cbCtlA.Caption
Err.Clear
End If
Next
Next
End Sub