+ Reply to Thread
Results 1 to 2 of 2

Hiding tabs and menus, toolbars, etc.

  1. #1
    Moiz
    Guest

    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. #2
    JNW
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1