Commandbar1_enter and commandbarcontrol1_enter subroutines
When developing a command bar solution, I often need to obtain the index, name, or title of a specific command bar or command bar control. I created CommandBarDocumenter and commandbarcontrol1_enter subroutines to record the public properties of all command bar and command bar controls in a given Office application.
To run these examples, copy the following code to the Code module of the Microsoft Office XP application in Visual Basic Editor, and then run one or both of the following subroutines. When a prompt appears, save the result as a text file (.txt ). This makes it easier to load results to applications (such as Microsoft Excel) for viewing and filtering.
Public Sub CommandBarDocumenter ()
'Purpose: Set information about all command columns in the current application.
'Write a text file.
'You must first set a reference to the Microsoft Script Runtime
'(Scrrun. dll) to make this code run correctly.
'Note: This code is only applicable to Microsoft Office XP.
Dim objCommandBar As Office. CommandBar
Dim strType As String
Dim strPosition As String
Dim objFileSaveDialog As Office. FileDialog
Dim objFSO As Scripting. FileSystemObject
Dim objTextStream As Scripting. TextStream
Const SAVE_BUTTON As Integer =-1
Set objFileSaveDialog = Application. FileDialog (msoFileDialogSaveAs)