View Full Version : Protect CommandBar Menu Item or Prevent use of VBE Menu during an Excel Session
cnirvana
05-04-2006, 03:07 PM
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.
Jacob Hilderbrand
05-04-2006, 06:31 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.
Application.CommandBars("CommandBarNameHere").Enabled = False
Or
Application.CommandBars("CommandBarNameHere").Controls("ControlNameHere").Enabled = False
cnirvana
05-04-2006, 06:39 PM
Thanks, just what I needed.
I never thought to look in Project properties.
cnirvana
Marcster
05-05-2006, 01:29 AM
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:
Application.CommandBars("ToolbarNameHere").Protection = msoBarNoCustomize
to reset:
Application.CommandBars("ToolbarNameHere").Protection = msoBarNoProtection
To disallow movement of commandbar use:
Application.CommandBars("ToolbarNameHere").Protection = msoBarNoMove
Marcster.
Jacob Hilderbrand
05-05-2006, 07:18 AM
You're Welcome :beerchug:
Take Care
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.