Private Sub Workbook_Activate()
On Error Resume Next
With Application
.DisplayFullScreen = True
.CommandBars("Worksheet Menu Bar").Enabled = False
End With
End Sub
Private Sub Workbook_Deactivate()
On Error Resume Next
With Application
.DisplayFullScreen = False
.CommandBars("Worksheet Menu Bar").Enabled = True
End With
End Sub
The above code when placed in the “Thisworkbook†module hides the default excel menu thread after enabling macro security on excel workbook.
But when Excel prompts the user to enable macros it shows the menu thread and then when the user enables the macro ribbon, it hides the menu thread.
Does excel have the capability or how can the code me modified to show only the “enable macros ribbon†without showing the “menu thread†on excel workbook open.
Your code mentions the Worksheet Menu Bar, which is only available in Excel 2003 and before, but you also mention the ribbon, which is only available in Excel 2007 and later, so I don't understand what you're doing here.
When a macro enabled workbook is opened it displays the bar or something saying "Security Warning Macros have been disabled. Options...
this is what I'm referring to.
Either add the folder containing the workbook to your trusted locations, or do the following:
- Click the Office button.
- Click Excel Options.
- Click Trust Center.
- Click Trust Center Settings...
- Click Macro Settings.
- Select "Disable all macros with notification".
- Click OK twice.
Yeah Jan,I had initially checked the site you had given. And I too preferred to choose the document with the name "XL Dictator (A)". The document shows up with a macro enabled sign. But there's no button to enable the macro.
Hide/Show the whole Ribbon with VBA
You can use this VBA example posted by Jim Rech to Hide/Show the whole ribbon.
Sub HideRibbon()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub
Sub ShowRibbon()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub