Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Hide menus etc in Excel 2007

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sandy - 12 Apr 2008 14:34 GMT
How can I convert the following to hide the menus and ribbon in Excel
2007?

  **********
  Dim Wksht As Worksheet

   With Application
        .DisplayFormulaBar = False
        .CommandBars("Worksheet Menu Bar").Enabled = False
        .CommandBars("Standard").Visible = False
        .CommandBars("Formatting").Visible = False
        .CommandBars("Drawing").Visible = False
   End With
  **********

Thanks
Sandy
Ron de Bruin - 12 Apr 2008 14:47 GMT
See this page Sandy
http://www.rondebruin.nl/ribbon.htm

See the xml examples (2)

> .DisplayFormulaBar = False
This is the same in 2007

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

>    How can I convert the following to hide the menus and ribbon in Excel
> 2007?
[quoted text clipped - 13 lines]
> Thanks
> Sandy
Rick Rothstein (MVP - VB) - 12 Apr 2008 15:18 GMT
And, if you want to use a single routine to toggle the visibility of the
Ribbon and Formula bar between visible and not visible with each call (so
you don't have to remember or check what state it is currently in), you can
use this macro....

Sub ToggleRibbonAndFormulaBar()
 ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon""," & _
                    CStr(Not Application.DisplayFormulaBar) & ")"
 Application.DisplayFormulaBar = Not Application.DisplayFormulaBar
End Sub

Rick

> See this page Sandy
> http://www.rondebruin.nl/ribbon.htm
[quoted text clipped - 21 lines]
>> Thanks
>> Sandy
Sandy - 12 Apr 2008 15:53 GMT
Thanks Ron

Perfect - can I ask another.........

I notice there is a 'new sheet' tab in 2007 - don't suppose you know how to
hide that or at least disable it?

Sandy

> See this page Sandy
> http://www.rondebruin.nl/ribbon.htm
[quoted text clipped - 21 lines]
>> Thanks
>> Sandy
Ron de Bruin - 12 Apr 2008 16:02 GMT
I think it is not possible but I not looked very good at it

Protect the workbook and it is not possible to insert new sheets (Review>Protect workbook)

For example Shift F11 will also insert a sheet so you must also disable this shortcut,
protecting the workbook is easier.

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> Thanks Ron
>
[quoted text clipped - 30 lines]
>>> Thanks
>>> Sandy
Rick Rothstein (MVP - VB) - 12 Apr 2008 16:59 GMT
You could use the Workbook's NewSheet event to delete the newly added sheet
as soon as it is added. Let's give you a way to toggle this 'feature' on and
off. Add a Module to your project (or use an existing Module if you have
one) and put this declaration into it...

Public BlockInsertSheet As Boolean

Now, double click on the ThisWorkbook entry in the Project window and put
the following code in the code window that appeared...

Private Sub Workbook_NewSheet(ByVal Sh As Object)
   If Not BlockInsertSheet Then Exit Sub
   With Application
       .DisplayAlerts = False
       .ScreenUpdating = False
   End With
   Sh.Delete
   With Application
       .DisplayAlerts = True
       .ScreenUpdating = True
   End With
End Sub

If you set BlockInsertSheet to True anywhere within your project, the user
will not be able to insert any new sheets. Unfortunately, the "Insert
Worksheet Tab" is still visible, but it won't function (so you might want to
consider putting a MessageBox at the end of the NewSheet event code telling
the user that Sheet inserts are disabled). Neither will right-clicking a tab
and selecting Insert from the popup menu. If you want, we can disable/enable
the popup menu's Insert item to coincide with the disabling or enabling of
inserting sheets. To do that, simply add this subroutine to the Module (do
not change the Module's BlockInsertSheet declaration nor the NewSheet event
code posted above)...

Sub AllowInsertSheets(Optional Status As Boolean = True)
 BlockInsertSheet = Not Status
 Application.CommandBars("Ply").FindControl(, 945).Enabled = Status
End Sub

But now, you do NOT set the BlockInsertSheet variable directly; instead, you
call the AllowInsertSheets subroutine with either a True (optional) or False
(required) argument to allow or disallow the inserting of sheets (the
subroutine will handle enabling or disabling the popup menu's Insert item).

Rick

> Thanks Ron
>
[quoted text clipped - 30 lines]
>>> Thanks
>>> Sandy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.