Moving a custom menu between templates

L

Larry

The answer to this is probably no, but is there a way to move an
individual custom menu (not a toolbar, but a customized menu that exists
on the menu bar) from one template to another? I have a feeling that
the only answer is to move the menu to a custom toolbar, then move that
toolbar to the other template, then drag the menu from the custom
toolbar to the menu bar. But I was hoping to find a more direct way of
doing this.

Another question: is there a way (other than visually searching through
all the menus) to get the menu location, if any, of any particular
command/macro button? Word 6 had this capacity; its Customize dialog
box has a menu assignment feature as well as a keystroke assignment
feature.

Larry
 
C

Cindy M -WordMVP-

Hi Larry,
The answer to this is probably no, but is there a way to move an
individual custom menu (not a toolbar, but a customized menu that exists
on the menu bar) from one template to another? I have a feeling that
the only answer is to move the menu to a custom toolbar, then move that
toolbar to the other template, then drag the menu from the custom
toolbar to the menu bar. But I was hoping to find a more direct way of
doing this.
The only other way would be to use VBA to recreate the menu in another
template or document.

And VBA would probably be the only answer to the next question, as well.
It could loop through all commandbars' controls until the menu point in
question is found.
Another question: is there a way (other than visually searching through
all the menus) to get the menu location, if any, of any particular
command/macro button? Word 6 had this capacity; its Customize dialog
box has a menu assignment feature as well as a keystroke assignment
feature.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Charles Kenyon

No, you can't copy/move customizations of built-in menus or toolbars
(including the menu bar) from one template to another. That is the main
reason for recommending that all customizations be created on custom
toolbars (and then possibly copied to a built-in menu or toolbar).

How to create copyable customizations to the built-in toolbars and menus:

Organizer will not copy customizations to built-in toolbars and menus, so
you have to work around this limitation. The way I have used is:

I create a shadow toolbar in my global template to hold my customizations.
It has a custom menu for each built-in menu or toolbar that I customize.

MyFile MyEdit MyView MyFormat, etc.

I use a separate shadow toolbar for the shortcut menus but you could put
them all on one if you wanted to, it depends on how many customizations you
do. I include a custom menu named Chas that has some of my favorite
templates and commands.

I put the customizations on those custom menus on this custom toolbar first.
That means using Customize to add the commands. Then, once I've added a
command to the custom toolbar, I Ctrl-drag it to the built-in.

You can use custom menus as a submenus to hold the deleted items, the
simplest way to do this would be to move the items from the File menu to the
MyFile | Deleted Items submenu and so forth.

This isn't perfect but it makes rebuilding the customizations to the
built-ins a lot less painful because the custom toolbar can be copied to
another template using the organizer.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
L

Larry

Charles, that's very interesting. I'll study this when I get a chance.

Cindy, a macro that would loop through all commandbars' controls until a
specific menu button is found, and then either giving the location of
that button, or else saying that the button doesn't exist, would be a
really useful thing. I wonder who would have the VBA skills to come up
with such a wonderful macro? :)

Larry
 
C

Cindy M -WordMVP-

Hi Larry,
Cindy, a macro that would loop through all commandbars' controls until a
specific menu button is found, and then either giving the location of
that button, or else saying that the button doesn't exist, would be a
really useful thing. I wonder who would have the VBA skills to come up
with such a wonderful macro? :)
OK, below my sig. Note that, as it stands, this will drill down 3 levels,
which is sufficient for any commands I'm aware of in a standard
installation. But you could expand it, building on the same pattern, if
you wish. More a problem is that you have to know exactly how it's
captioned. This means you have to mark the accelerator key (with an &);
any ellipses and case-sensitivity are dealt with in the function at the
end.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)

Sub FindMenuButton()
Dim strMenuCaption As String
Dim strMenuLocation As String
Dim cbL1 As CommandBar
Dim cbL2 As CommandBar
Dim cbL3 As CommandBar
Dim cbL4 As CommandBar
Dim btn As Office.CommandBarControl
Dim btnL2 As Office.CommandBarControl
Dim btnL3 As Office.CommandBarControl
Dim btnL4 As Office.CommandBarControl

strMenuCaption = "&Caption"
For Each cbL1 In CommandBars
strMenuLocation = cbL1.Name
For Each btn In cbL1.Controls
If EditButtonCaption(btn.Caption) =
EditButtonCaption(strMenuCaption) Then
strMenuLocation = strMenuLocation & "/" & btn.Caption
MsgBox strMenuLocation
Exit Sub
Else
If btn.Type = msoControlPopup Then
Set cbL2 = btn.CommandBar
For Each btnL2 In cbL2.Controls
If EditButtonCaption(btnL2.Caption) =
EditButtonCaption(strMenuCaption) Then
MsgBox strMenuLocation & "/" & cbL2.Name & "/"
& btnL2.Caption
Exit Sub
Else
If btnL2.Type = msoControlPopup Then
Set cbL3 = btnL2.CommandBar
For Each btnL3 In cbL3.Controls
If EditButtonCaption(btnL3.Caption) =
EditButtonCaption(strMenuCaption) Then
MsgBox strMenuLocation & "/" &
btn.Caption & "/" & btnL2.Caption & "/" & btnL3.Caption
Exit Sub
Else
If btnL3.Type = msoControlPopup
Then
Set cbL4 = btnL2.CommandBar
For Each btnL4 In cbL4.Controls
If
EditButtonCaption(btnL4.Caption) = EditButtonCaption(strMenuCaption) Then
MsgBox strMenuLocation
& "/" & btn.Caption & "/" & btnL2.Caption & "/" & btnL3.Caption & "/" &
btnL4.Caption
Exit Sub
End If
Next
End If
End If
Next btnL3
End If
End If
Next btnL2
End If
End If
Next
Next
End Sub

Function EditButtonCaption(cap As String) As String
If Right(cap, 3) = "..." Then
EditButtonCaption = LCase(Mid(cap, 1, Len(cap) - 3))
Else
EditButtonCaption = LCase(cap)
End If
End Function
 

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