Menu customizations - how to determine them

B

Bear

I'm rebuilding my tools global add-ins. I plan to export all the objects,
forms, and modules, then import them into a new, otherwise blank template.

Reestablishing the keybindings isn't a big problem. But I'm stuck on menu
customizations.

Does anyone know how to determine and list the menu customizations in an
add-in?

Bear
 
L

Lene Fredborg

Maybe you can use the following macro as a starting point (but I am not sure
whether it gathers the type of information you want). The macro iterates
through all commands in the Menu Bar. For each command in each menu, it
checks whether the command is built-in. If it is not, information about the
command is inserted at the end of the active document. You could gather more
information about each command if needed.


Sub FindCustomCommands()
Dim oControl_1 As CommandBarControl
Dim oControl_2 As CommandBarControl
Dim oDoc As Document
Dim strInfo As String
Dim n As Long

Set oDoc = ActiveDocument
n = 0 'use as counter

For Each oControl_1 In CommandBars("Menu Bar").Controls
For Each oControl_2 In oControl_1.Controls
If oControl_2.BuiltIn = False Then
'Gather info about the control:
'- Caption of the menu without the & character
'- Caption of the command itself
'- The name of the macro that is executed by the command

strInfo = "Menu :" & Replace(oControl_1.Caption, "&", "") &
vbCr & _
"Caption: " & oControl_2.Caption & vbCr & _
"Macro: " & oControl_2.OnAction
n = n + 1
'Insert the information at the end of oDoc
oDoc.Range.InsertAfter vbCr & vbCr & strInfo
End If
Next oControl_2
Next oControl_1

MsgBox "Finished." & vbCr & n & " custom commands found."
Set oDoc = Nothing
End Sub

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
B

Bear

Lene:

Perfect! How simple things can be when one has the right perspective.

All I have to do is turn off the add-ins I'm not interested in and run that
puppy.

After I posted, I also found this approach:

http://www.addbalance.com/word/movetotemplate.htm

Scroll to the heading: "How to create copyable customizations to the
built-in toolbars and menus."

The idea is to start with a duplicate set of toolbars to store copies of
your customizations. These can be moved between templates.

Of course, if you haven't been using this approach all along, you're still
at a loss trying to remember the two or three dozen customizations you've
already made. But the code you sent should handle that.

Bear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top