"Menu Bar" corruption

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a simple document template that contains one drop down menu item on "menu bar" which in turn contains one several menu items. I then put this into the startup folder so that it appears for all document and everything is AOK
Now for the problem; when I go to customise the menus by trying to drag my menu item to a different location ( or by doing Application.CommandBars("Menu Bar").Controls("My Menu Item").Move ) my menu item is moved correctly but its sub menu items disappear
How can I stop this happening
I can do this programmatically by changing the customisation context, but this will not prevent the error occuring if a user modifies the menu by dragging it
Any ideas?
 
Hi =?Utf-8?B?QnJpZGdl?=,

Are you making sure to change the "Save in" or "Look in" or "Available in" setting in the Tools/Customize dialog box? You do need to do this (or the user does) in order to avoid misunderstandings of this sort...
I have created a simple document template that contains one drop down menu item on "menu bar" which in turn contains one several menu items. I then put this into the startup folder so that it appears for all document and everything is AOK.
Now for the problem; when I go to customise the menus by trying to drag my menu item to a different location ( or by doing Application.CommandBars("Menu Bar").Controls("My Menu Item").Move ) my menu item is moved correctly but its sub menu items disappear.
How can I stop this happening?
I can do this programmatically by changing the customisation context, but this will not prevent the error occuring if a user modifies the menu by dragging it.
Any ideas?

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 :-)
 
The new menu item lives in global template AAA.dot.
The active document is based on normal.dot. Because of this it is only
possible to change the context to either normal.dot or to the document
itself, neither of which are the global template the menu item lives in.

Cindy M -WordMVP- said:
Hi =?Utf-8?B?QnJpZGdl?=,

Are you making sure to change the "Save in" or "Look in" or "Available in"
setting in the Tools/Customize dialog box? You do need to do this (or the
user does) in order to avoid misunderstandings of this sort...menu item on "menu bar" which in turn contains one several menu items. I
then put this into the startup folder so that it appears for all document
and everything is AOK.my menu item to a different location ( or by doing
Application.CommandBars("Menu Bar").Controls("My Menu Item").Move ) my menu
item is moved correctly but its sub menu items disappear.but this will not prevent the error occuring if a user modifies the menu by
dragging it.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)


This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
To customize the global template, you must open it for editing so that it
becomes available as the customization context.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
The menu item is in a global template but the user is trying to customise
their own confirguration. They would not know, or have any reason to know,
which template a menu was actually in. During the menu move Word is
corrupting the Menu item as any subsiquent calls to
Application.CommandBars("Menu Bar").Controls("My Menu Item").Controls fails
as the inner Controls object has become invalid.
 
Hi Bridge,

In this case, probably the best thing to do would be to protect the command bar against customization. Go to some code you have that manipulates (these) commandbars and type something like CommandBars("Foobar").Protection, then press F1 to open the VBA Help to this topic. You'll find you can protect it in various ways :-)
The menu item is in a global template but the user is trying to customise
their own confirguration. They would not know, or have any reason to know,
which template a menu was actually in. During the menu move Word is
corrupting the Menu item as any subsiquent calls to
Application.CommandBars("Menu Bar").Controls("My Menu Item").Controls fails
as the inner Controls object has become invalid.

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 :-)
 
Hi Cindy,

Following your instructions I clicked on the "Protection Property" link and
found the following constants which appear to be self-explanatory.

msoBarNoChangeDock
msoBarNoChangeVisible
msoBarNoCustomize
msoBarNoHorizontalDock
msoBarNoMove
msoBarNoProtection
msoBarNoResize
msoBarNoVerticalDock


Thanks for the guidance.
--

Charles Kenyon

See 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.

Cindy M -WordMVP- said:
Hi Bridge,

In this case, probably the best thing to do would be to protect the
command bar against customization. Go to some code you have that manipulates
(these) commandbars and type something like
CommandBars("Foobar").Protection, then press F1 to open the VBA Help to this
topic. You'll find you can protect it in various ways :-)
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)


This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
Already tried the protection property and it does not work.
The protection has to be set in the template where the menu item lives and
has no effect if the customisation context is different. So in this
situation where the new menu is in a global template AAA.dot but it is
actually normal.dot which is being customised by a user there is no
protection against the menu item being modified.
Thanks for all your advise but I'm still right where I started :(
 
Hi Bridge,

Is this problem actually occurring "out in the field", or is it one you're considered about might happen?

Generally, I don't find the users will try to move a top-level menu around. Most users don't even know it's possible to do this, and the ones who do one should be able to tell: don't do that.

If this is really a problem, then I can make a couple of suggestions
- Put the command on its own toolbar, and protect that
- Provide a command in your menu that gives the user an interface for moving it (calls a macro where the user can tell you where to put it, and you do it with code in the correct customization context)
- Have your template check on startup (AutoExec) for the presence of the menu in the correct position, and if it doesn't find it there, recreate it
- Have the template search for the presence of the top-level command in all the menu levels, check for the sub-menus, and recreate them as required
- If the users of the template are really doing this, won't stop, and complain anyway, have your template create the menu in the Normal.dot template, instead of having it in your template
Already tried the protection property and it does not work.
The protection has to be set in the template where the menu item lives and
has no effect if the customisation context is different. So in this
situation where the new menu is in a global template AAA.dot but it is
actually normal.dot which is being customised by a user there is no
protection against the menu item being modified.
Thanks for all your advise but I'm still right where I started :(

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 :-)
 

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

Back
Top