Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Hiding tabs and menus, toolbars, etc.

I want to open an excel file so that when it opens it hides all menus, tabs,
toolbars, etc.

then when it closes it resets everything to its origininal settings

can you advise the code, please.

Moiz


  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Hiding tabs and menus, toolbars, etc.

I found this code somewhere on the forum or searching online. It hides all
toolbars, scrollbars, and some other things when the workbook is activated,
then shows them again when deactivated (especially for switching between
workbooks)

Place all of the following in "thisWorkbook" object code. Create a sheet in
your workbook to hold the names of the toolbars that get hidden (able to
accomodate multiple users this way). Make sure to change the code below by
inserting the name of your workbook and the sheet that will contain the
toolbar names.


Private Sub Workbook_Activate()
Dim LoginAccess As Variant
Dim TBarCount As Integer
Dim cbar As CommandBar
On Error Resume Next
'Removes Toolbars
Sheets("sheet name").Range("A:A").ClearContents
TBarCount = 0
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypeNormal Then
If cbar.Visible Then
TBarCount = TBarCount + 1
Workbooks("wb name").Sheets("sheet
name").Cells(TBarCount, 1) = _
cbar.Name
cbar.Visible = False
End If
End If
Next cbar
With Application
.DisplayFormulaBar = False
.DisplayStatusBar = False
.DisplayScrollBars = False
End With
End Sub



Private Sub Workbook_Deactivate()
Dim Row As Long
Dim TBar As String

Row = 1
TBar = Workbooks("wb name").Sheets("sheet name").Cells(Row, 1)
Do While TBar < ""
Application.CommandBars(TBar).Visible = True
Row = Row + 1
TBar = Workbooks("wb name").Sheets("sheet name").Cells(Row, 1)
Loop
With Application
.DisplayFormulaBar = True
.DisplayStatusBar = True
.DisplayScrollBars = True
End With
End Sub


"Moiz" wrote:

I want to open an excel file so that when it opens it hides all menus, tabs,
toolbars, etc.

then when it closes it resets everything to its origininal settings

can you advise the code, please.

Moiz



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Menus and Toolbars Needy Ned Excel Discussion (Misc queries) 1 November 6th 08 04:45 PM
Custom Menus and Toolbars TedZee Excel Discussion (Misc queries) 1 July 6th 07 12:16 AM
Missing menus and toolbars Graham Haughs Excel Discussion (Misc queries) 1 December 23rd 05 07:53 PM
Toolbars and menus DMc2005 Excel Programming 0 October 18th 05 09:46 PM
No menus, no toolbars, no nothing!! CR[_4_] Excel Programming 4 September 16th 05 03:50 PM


All times are GMT +1. The time now is 06:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"