Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Menus and Toolbars | Excel Discussion (Misc queries) | |||
Custom Menus and Toolbars | Excel Discussion (Misc queries) | |||
Missing menus and toolbars | Excel Discussion (Misc queries) | |||
Toolbars and menus | Excel Programming | |||
No menus, no toolbars, no nothing!! | Excel Programming |