How might I prevent use of a custom CommanBar menu item or prevent users from using VBE to view or modify my code. Worksheet, Workbook, and Chart protection fail to prevent use of or access to VBE during Excel session.
How might I prevent use of a custom CommanBar menu item or prevent users from using VBE to view or modify my code. Worksheet, Workbook, and Chart protection fail to prevent use of or access to VBE during Excel session.
Last edited by cnirvana; 05-04-2006 at 06:18 PM.
You can protect the VBA code from being viewed.
In the VBE click Tools | VBA Project Properties | Protection
Check lock project for viewing and then enter a password.
If you want to disable a command bar you can use this.
[VBA]Application.CommandBars("CommandBarNameHere").Enabled = False[/VBA]
Or
[VBA]
Application.CommandBars("CommandBarNameHere").Controls("ControlNameHere").E nabled = False
[/VBA]
Thanks, just what I needed.
I never thought to look in Project properties.
cnirvana
Someone could reset/customize your toolbar by using the Customize
dialog (Tools > Customize).
To stop someone from resetting or customizing a commandbar
you can use:
[VBA]
Application.CommandBars("ToolbarNameHere").Protection = msoBarNoCustomize
[/VBA]
to reset:
[VBA]
Application.CommandBars("ToolbarNameHere").Protection = msoBarNoProtection
[/VBA]
To disallow movement of commandbar use:
[VBA]Application.CommandBars("ToolbarNameHere").Protection = msoBarNoMove[/VBA]
Marcster.
You're Welcome
Take Care