» Change the availability for a menu item using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - Menus, Toolbars, Status bar in VBA
VERSION - All Microsoft Excel Versions
Sub ToggleMenuControls()
Dim m As CommandBarControl, mi As CommandBarControl
Set m = CommandBars.FindControl(ID:=30002) ' File Menu
If m Is Nothing Then Exit Sub
For Each mi In m.Controls
If mi.ID = 18 Then mi.Enabled = Not mi.Enabled
' toggles the state for the Print menu
Next mi
Set mi = Nothing
Set m = Nothing
End Sub
Book Store:
Recommended Books:
- The Essential 55: An Award-Winning Educator's Rules for Discovering the Successful Student in Every Child
- Marketing Plans
- Good to Great: Why Some Companies Make the Leap... and Others Don't
- Accounting for Dummies
- East of Eden (Oprah's Book Club)
- Treason: Liberal Treachery from the Cold War to the War on Terrorism
Fine, but...
Antti Posted on: 31-12-1969
...how do i disable print commands and buttons from menu and toolbars? The above disabled command File -> new. 

