Making a [semi] Dictator Application: Hiding Main Command Bar?

D

dim

Hi all,

I have included a variety of elements in my auto-open macro to hide shortcut
bars and such, and I just added in Application.ShowWindowsInTaskbar =
False....anyway...I want to also hide the main command bar that has the File,
Edit, View, Insert, Format, Tools etc drop down menus at the top of my Excel
program window. I dont need to replace these with my own, so I don't need to
know how to do that right now....just the VBA code to hide it. How do I hide
it?

Thanks.
 
C

Chip Pearson

Try

Application.CommandBars("Worksheet Menu Bar").Enabled = False


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
D

dim

ARGH!!! That worked...thanks....now its gone whenever I open Excel and I cant
get it back! :-(

Is there a shortcut key to get into VBA code when opening a program so I can
change it back?

.....oops! :-o
 
G

Gord Dibben

Alt + F11 wil open the VB Editor so you can change the code.

To just get the worksheet menu back..............

View>Immediate Window copy this into the window and hit Enter key

Application.CommandBars("Worksheet Menu Bar").Enabled = True

BTW.......you should always revert to default when you close the workbook.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Caption = ""
ActiveWindow.Caption = ""
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = True
End With
With Application
.CommandBars("Worksheet Menu Bar").Enabled = True
.DisplayFormulaBar = True
.DisplayStatusBar = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
End With
End Sub


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top