Custom Toolbar showing in any and all workbooks opened

G

Guest

Created a custom toolbar for a template using the customize command. Assign
each button in the custom toolbar to a macro. Recorded the macros careful to
assign them only to current Workbook. Now no matter what document I open the
custom toolbar is opened also. When I goto Tools>Macro>Macros there are not
maros listed for any of the choices (This workbook, All Open workbooks,etc).
Is there a simple way short of writing VBA to restrict this toolbar to
opening only in the document for which it was created?

Thanks
 
Z

Zone

Jack, open Excel and open the workbook for which the toolbar was
created. Right-click on the toolbar and select customize. On the
Toolbars tab, click Attach. Select the toolbar from the list. Click
Copy. Click OK. This attaches the toolbar to the worksheet. Alt-F11
to view the code editor. If you do not have a standard module, click
Insert, then Module. In the standard module, put
Sub Auto_Open()
Commandbars("NameOfToolbarHere").Visible=True
End Sub
Sub Auto_Close()
Commandbars("NameOfToolbarHere").Delete
End Sub
Of course, put the name of your toolbar in place of NameOfToolbarHere,
leaving the quotes in. Now, when you close Excel, the toolbar will be
deleted from the toolbar collection. When you open the file again, the
toolbar will be shown. James
 

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

Top