PDA

View Full Version : Solved: disable close button on custom toolbar



OTWarrior
10-22-2007, 09:08 AM
in a word document that the team will use, i have a custom toolbar with features (macros) on it. I am thinking ahead that one of them may click the close button and not know how to bring it back up, so I was wondering how you could disable such an option, if at all.


to put it simply:

How do you make sure the user cannot close a toolbar?

lucas
10-22-2007, 12:07 PM
Add a menu item instead......click here (http://slucas.virtualave.net/Wink/CustomMenuItem.htm) to see how to get started.

OTWarrior
10-23-2007, 01:02 AM
that is a great idea, but i kinda need it to be in a toolbar so it is easily visible to the user (some of them are not very experienced on computers) and having it in a menu would confuse them, as they may not notice it there.

(Having said that, that was a great link and I shall find a use for it in future, thank you :))

TonyJollans
10-23-2007, 01:37 AM
CommandBars("Custom Toolbar").Protection = msoBarNoChangeVisible

OTWarrior
10-23-2007, 02:30 AM
thanks Tony, I put it into a document_open sub and it worked perfectly :)

TonyJollans
10-23-2007, 02:45 AM
Protection is a property of the toolbar - once it's set you shouldn't need to do it every time.

OTWarrior
10-23-2007, 03:26 AM
Ah ok, I thought it may reset itself when word closes (or rather the document closes).

Even better, less code to leave in the document :)

TonyJollans
10-23-2007, 09:02 AM
It occured to me that, for anybody who reads this in the future, I should give a little more detail. CommandBar Protection is a series of bit flags and if someone already had a different type of protection in place the code would overwrite that. So it would be better to use ...
CommandBars("Custom").Protection = CommandBars("Custom").Protection Or msoBarNoChangeVisible