The macro below shows how you can toggle the availability state for a menu item.
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
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.
..how do i disable print commands and buttons from menu and toolbars? The above disabled command File -> new.
..how do i disable print commands and buttons from menu and toolbars? The above disabled command File -> new.