Discussion Locked

Excel Toolbars

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have created a workbook and saved it as Test.xls

In this workbook I have macros that drive certain functions of the various worksheets and attached these macros to a custom Toolbar. I saved them in the current workbook not in Personal.xls

My problem is when I save the workbook to a different file name and use the custom Toolbar I created with the macros it wants to load the file Test.xls to execute the macros.

How do I make the macros reference the active workbook I am working on and not reference the workbook that the macros were originally created in

3 replies

by dklippert

In another forum, Bill Manville MVP - Microsoft Excel, Oxford, England, suggested:

"The best way to handle workbook-specific commandbars is to attach the
commandbar to your workbook (View / Toolbars / Customise / Attach) and, in
Workbook_BeforeClose, to delete the toolbar from the user's customisation:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Macros").Delete
End Sub"

This discussion is closed to new replies.