ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable commands for one workbook (https://www.excelbanter.com/excel-programming/384537-disable-commands-one-workbook.html)

Steve C

Disable commands for one workbook
 
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.Ite m("&Customize...").Enabled
= False
Application.CommandBars("Toolbar List").Enabled = False


--
Steve C

Ron de Bruin

Disable commands for one workbook
 
Hi Steve

Read the Information part (3)
http://www.rondebruin.nl/menuid.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Steve C" wrote in message ...
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.Ite m("&Customize...").Enabled
= False
Application.CommandBars("Toolbar List").Enabled = False


--
Steve C


Tom Ogilvy

Disable commands for one workbook
 
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

--
Regards,
Tom Ogilvy


"Steve C" wrote:

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.Ite m("&Customize...").Enabled
= False
Application.CommandBars("Toolbar List").Enabled = False


--
Steve C


Steve C

Disable commands for one workbook
 
Thank you both!
--
Steve C


"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy


"Steve C" wrote:

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.Ite m("&Customize...").Enabled
= False
Application.CommandBars("Toolbar List").Enabled = False


--
Steve C



All times are GMT +1. The time now is 09:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com