
Tips.Net > WordTips Home > Word's Environment and Interface > Customizing Word > Locking the Position of Custom Toolbars
Summary: Is your Custom Toolbar in a new place each time you open Word? Here are some solutions. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)
If you have developed custom toolbars in Word, you may have noticed a problem with them. Do they "move around," meaning that they are in different places every time you start Word? If this is the case, you may be wondering how to make the toolbars stay put, exactly where you want them to be.
The first thing to understand is that positioning information for toolbars is maintained by Word in the HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Word\Data Registry key. (Actually, the 9.0 portion of the key changes, depending on your version. This is for Word 2000. If you are using Word 97, it is 8.0, and it is 10.0 for Word 2002.)
Whenever you exit Word, the toolbar positions are written into the Registry. Because of this, you can try these steps to permanently position the toolbars:
The next time you start Word, the toolbars should be where you want them to be. If they aren't, you may want to exit Word and try deleting the \Word\Data Registry key, as described earlier in this tip. When you next start Word, the Registry key is automatically created, and you can again try positioning the toolbars.
Another approach is to use a macro to lock the position of your toolbars. Add the following macro to the Document New event of the template itself.
Sub LockAllVisibleToolbars()
Dim cb As CommandBar
For Each cb In CommandBars
If cb.Visible = True Then
cb.Protection = msoBarNoChangeDock + _
msoBarNoChangeVisible + _
msoBarNoCustomize + _
msoBarNoMove + _
msoBarNoResize
End If
Next cb
End Sub
It is, of course, run each time a new document is created based on the template. The macro locks the position of the toolbars and does not allow them to be moved or customized. You can unlock the toolbars by running this macro:
Sub UnlockAllVisibleToolbars()
Dim cb As CommandBar
For Each cb In CommandBars
If cb.Visible = True Then
If cb.Name = ("Task Pane") Then
cb.Protection = msoBarNoCustomize
Else
cb.Protection = msoBarNoProtection
End If
End If
Next cb
End Sub
Tip #1354 applies to Microsoft Word versions: 97 2000 2002 2003
Ultimate Library! The most amazing collection ever offered in the history of WordTips places every tip—present and historical—at your fingertips. Check out the WordTips Ten-Year Library.
The real power behind Word's best documents lies in understanding styles and templates. Learn the key to more powerful document creation. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Pet Tips
Word2007 Tips
WordTips