Hide Toolbars

J

Jennifer

Hi All
I just created an excel template and I want to know how
to hide the standard & formating toolbars as well as the
main menus of Excel, when anyone opens this template.
TIA.
JD
 
B

Bob Phillips

Application.Commandbars("Worksheet Menu Bar").Enabled = False
Application.Commandbars("Standard").Visible= False
Application.Commandbars("Formatting").Visible= False

Put this code in the workbook open event, and reset it on workbook close, or
even deactivate.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Guest

or...

public sub Handlebars(byval xEnable as boolean)
dim oBar as commandbar

' disable/enable ALL builtin commandabrs (toolbars & menus!)
for each obar in application.commandbars
if obar.builtin then
obar.enabled=not xEnable
end if
next

end sub

then all you do is call it from the Workbook_Open event handler like this:Handlebars true
<<

and in the Workbook_beforeclose event like this:Handlebars false
<<

of course, you will have to modify as needed, for example, if you still want
the user to be able to right-click on a worksheet or cell and show the popup
menus...

also, be careful with code like this, if for example you turn event-handlers
off sometime when the workbook is open (Application.enableevents=false) and
excel crashes, then it won't put them back and you have to do it the awkward
way to reset them again!

Perhaps therefore it's better to use .Visible = false instead of disabling
them...

all depends on why, and if it's a problem when the users show the toolbars
themselves through the Customize dialog by double-clicking in the commandbar
area at the top of Excel...

hth

Philip
 

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