ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Toolbars (https://www.excelbanter.com/excel-programming/320960-hide-toolbars.html)

jennifer

Hide Toolbars
 
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


Bob Phillips[_6_]

Hide Toolbars
 

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)


"Jennifer" wrote in message
...
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




Philip

Hide Toolbars
 
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

"Bob Phillips" wrote:


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)


"Jennifer" wrote in message
...
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





Ron de Bruin

Hide Toolbars
 
Hi Jennifer

See also
http://www.rondebruin.com/menuid.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Jennifer" wrote in message ...
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





All times are GMT +1. The time now is 11:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com