how do I lock toolbars?

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

Guest

Anyone know of a way to lock toolbars in Word 2003 like you can in IE6? Is
there a hidden command I can't find?
 
Take a look at the options for the commandbar.Protection property.
 
Where do I need to look? I don't see that tab under options nor in the
protect documents area...

Thanks!
 
That would be in VBA.

--
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.
 
I have never used VBA before... can you give me step by step instructions for
the novice user, or direct me to some online? Thanks!
 
These two commands might help.

The first prevents customization period.

The second prevents customization of the named toolbar.

Sub Test()
Application.CommandBars.DisableCustomize = False
End Sub
Sub Test1()
Application.CommandBars("Formatting").Protection = msoBarNoCustomize
End Sub

See: http://www.gmayor.com/installing_macro.htm
 
From the Menu (in Word) select Tools > Macro > Macros... (or just press the
Alt+F8 shortcut)

In the Window which opens up (the "VBE") you should see a window on the
right headed "Project - Something or Other".

This is a tree view of the Documents and Templates you have open. In this
list find the document in which you've saved your toolbar - the document
name is the one in parentheses probably following "Project" - or if you are
trying to protect a built-in toolbar, find the entry named "Normal". Select
the entry you have found.

On the Menu (in the VBE) click on Insert > Module. A blank window will open
up.
Again from the Menu, select Insert > Procedure. A dialog will open up -
enter a Name (say "ProtectToolBar") and Press OK
Some code will be added to the window. like this ...

Public Sub ProtectToolbar()

End Sub

Place your cursor on the blank line between the two lines of code and type
CustomizationContext = MacroContainer
(this isn't necessary (but is harmless) if you are doing this in Normal.dot)

Press Return and on the next line type ...
CommandBars("NameOfTheCommandBarYouWantToLock").
(with the appropriate name, of course)

After you type the dot at the end adropdown will appear. Either type or
select from the list, Protection
Type (space) = (space)
Another dropdown will open up with a list of names beginning mso...
Select (or type) one of these, say msoBarNoCustomize - as Greg suggests

Press F5 to run the code.

This will stop anyone adding (or removing) buttons.They will still be able
to move the toolbar. If you also want to stop that you will need to add some
extra protection.

Go back and place ypur cursor at the end of the line (after
msoBarNoCustomize) and type (space) + (space) and the list of mso...
constants will again appear.

This time select msoBarNoMove, so your code looks like this ...

Public Sub ProtectToolbar()
CustomizationContext = MacroContainer
CommandBars("Standard").Protection = msoBarNoCustomize + msoBarNoMove
End Sub

Press F5 again to run this new code.

Now you will not be able to add or remove icons, nor will you be able to
move the toolbar (the grab handle will vanish)

As many as you want of the different types of protection can be added up in
this way - the names are fairly self-explanatory but Help or, better, simple
experimentation, will show what each does.

When you have finished you can close the VBE by pressing the X in the top
right or pressing Alt+F4 just like any other normal window.
 
Tony,

I'm not the OP, but have a question about this anyway...

I'm using your method to lock all the toolbars from moving (which is
EXTREMELY helpful to me, I'm always dragging those suckers everywhere!).
I've gotten everything locked but the Menu toolbar (File..Edit...etc). I
tried just using "Menu" , but VB didn't like that very much. Do you have any
idea what the name of that one would be?

Brandie
 
Hi Brandie,

If you pick it up and drop it somewhere on the document body, it will float
with a title bar showing its name. It's called "Menu Bar".
 
Thanks a bunch Tony!

Tony Jollans said:
Hi Brandie,

If you pick it up and drop it somewhere on the document body, it will float
with a title bar showing its name. It's called "Menu Bar".
 

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