XL: Unexpected Behavior with Attached Toolbars

Last reviewed: February 2, 1998
Article ID: Q125847
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0
  • Microsoft Excel for the Macintosh, version 5.0
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel 97 for Windows
  • Microsoft Excel 98 Macintosh Edition

SUMMARY

In Microsoft Excel, custom toolbars can be attached to workbooks to allow the toolbar to be stored in the document, and these toolbars can be made available when the document is opened. However, the attached toolbar may not appear as expected when either of the following conditions is true:

  • The attached toolbar is not loaded

        -or-
    
  • The attached toolbar reverts to a previous version

For more information about these conditions, see the appropriate section in the "More Information" section of this article.

To ensure that an attached toolbar is updated when the toolbar is modified, you must choose Attach Toolbars from the Tools menu and re-copy the toolbar to the worksheet each time you modify the toolbar.

MORE INFORMATION

Attached Toolbar Is Not Loaded

If a custom toolbar attached to a workbook has the same name as an existing custom toolbar in the current Microsoft Excel session, the attached toolbar will not replace the existing toolbar when the workbook is opened. Any Visual Basic macro code that references the attached toolbar will instead reference the pre-existing toolbar. For example, if a currently running Microsoft Excel session has an existing toolbar named "My Toolbar," and you open a file that has an attached toolbar also named "My Toolbar," Microsoft Excel will not load "My Toolbar" from the file. If a Visual Basic macro subsequently issues the command

   Toolbars("My Toolbar").Visible=True

the pre-existing toolbar in the Microsoft Excel session will be displayed rather than the recently attached toolbar.

Attached Toolbar Reverts to Previous Version

If you attach a custom toolbar to a workbook, modify it, and then save the workbook, the attached toolbar will not reflect any changes made after the toolbar has been attached. You will not notice this behavior until you open the workbook on a different computer. For example, you will notice this problem if you do the following:

  1. Create a custom toolbar named "My Toolbar" that has two buttons.

  2. Attach this toolbar to a workbook, and add a third button to it.

  3. Save and close the workbook.

If you do not delete "My Toolbar" in the current session of Microsoft Excel, and if you reopen the file, the attached toolbar will not be loaded and three buttons will be seen on "My Toolbar." However, if you open the workbook in a different installation of Microsoft Excel (on another computer, for example) that does not contain a custom toolbar named "My Toolbar," the attached toolbar will be loaded, and "My Toolbar" will display the two buttons that were present at the time it was attached to the worksheet.

REFERENCES

"Microsoft Excel User's Guide," version 5.0, page 638 "Microsoft Excel Visual Basic User's Guide," version 5.0, pages 262-264


Additional query words: 7.00 5.00 8.0 8.00 xl97 xl7 commandbars

Keywords : xlloadsave xlui kbcode kbprg kbtool
Version : WINDOWS: 5.0, 5.0c, 7.0, 97; MACINTOSH: 5.0, 5.0a, 98
Platform : MACINTOSH WINDOWS
Issue type : kbprb kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.