Disable commands for one workbook

S

Steve C

I am using the following commands to disable certain options for a specific
workbook. However, if any other workbooks are open, these same options are
also disable for them. How can I disable commands only for a specific
workbook rather than all open workbooks? Thanks.

Application.CommandBars.Item("Data").Controls.Item("Filter").Controls.Item("&Advanced Filter...").Enabled = False
Application.CommandBars.Item("Tools").Controls.Item("&Customize...").Enabled
= False
Application.CommandBars("Toolbar List").Enabled = False
 
T

Tom Ogilvy

These are application level settings. Therefore you would need to set them
each time a workbook became active. Instantiate application level events in
this workbook and use the WorkbookActivate and WorkbookDeactivate events to
control the settings

http://www.cpearson.com/excel/appevent.htm
 

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