You are visitor number ????? since 2 October 2004.
Go to Howard Kaikow's home page


Date: 3 October 2004(Revision of 2 October 2004 version)
From: Howard Kaikow <kaikow@standards.com>
Subject: Failure to delete a toolbar


It should be possible to delete a toolbar, then rebuild the toolbar in the same Word template. However, there are circumstances in which the previous toolbar(s) are not deleted and they may mysteriously travel in position from left to right.

Although the macro appears to delete the toolbar. When Word is exited and then restarted, there is more than one instance of the toolbar.

This behavior has been seen in Word 2000, Word 2002, and Word 2003, but not in Word 97.

I am providing a .zip file that contains two Word templates. At this time, I am providing templates that were created in Word 97, but the template should be usable in Word 97, Word 2000, Word 2002, and Word 2003.

Both templates should create a toolbar, "Test Toolbar", that you can use to run the macros to be tested.

Each template has two macros. One creates a toolbar in the Normal template. The other creates the toolbar in the template itself.

My experience has been that the macro produces the expected result when the toolbar is created in the template itself, i.e., there is never more the one copy of the toolbar.

However, when the toolbar is created in the Normal template, eventually, more than one copy of the toolbar will be created in the Normal template and, eventually, the toolbar(s) will travel from left to right on subsequent invocations of the macro.

In order to reproduce the results, please do exactly the following:

  1. Save a copy of your Normal template so you can restore the original copy after testing
  2. Double-click on the template I supplied.
  3. Click the "TestCustomizationContextNormalTemplate" button.
  4. Exit from Word, if requested, saving changes.
  5. Start Word with the Normal template, then exit from Word.
  6. Repeat steps 2 to 5 until the problem occurs. It may be necessary to repeat the steps two to three, or more, times.
  7. When you are finished, restore your saved copy of the Normal template.

OK, now try creating the toolbar in the template itself.

  1. Double-click on the template I supplied.
  2. Click the "TestCustomizationContextMacroContainer" button.
  3. Exit from Word, if requested, saving changes.
  4. Repeat steps 1 to 3 until the you are satisfied the problem does not occur in this case. If the problem does occur, please let me know.

Note that copying the macros from the template to the Normal template and then running the macros in the Normal template does not avoid the error. Indeed, it is worse because then the MacroContainer context example also fails to produce correct behavior,