Hide all toolbar , open always on the same sheets and hide some of the sheets..inside..


Posted by NiuB on July 13, 2001 12:16 AM

Hello guys,

1. I like to hide all toolbars includes header column,horizantal and vertical scroll bar
and sheets tab

2. I'm also want to start my wb always on the same sheet..let say I have
5 sheets..A,B,C, D, E .I always want my wb to be open at sheet C

3. I'm also want to hide some of my sheets..lets say I want to hide
sheet D and E..many of the code that i saw gives an error when people
hide some of their sheets


What is the code to perform all this task on open the wb..like sub auto_open routine..

many thanks



Posted by Alix on July 13, 2001 6:42 AM

Try this

Add these macros to a module


Sub VisibleSheets()

Sheets("A").Visible = True
Sheets("B").Visible = True
Sheets("C").Visible = True
Sheets("C").Select
Sheets("D").Visible = xlSheetHidden
Sheets("E").Visible = xlSheetHidden

End Sub

Sub HideScrolls()

ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.DisplayVerticalScrollBar = False

End Sub


Sub HideToolbars()

Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False

End Sub


Sub ShowScrolls()

ActiveWindow.DisplayHorizontalScrollBar = True
ActiveWindow.DisplayVerticalScrollBar = True

End Sub


Sub ShowToolbars()

Application.CommandBars("Standard").Visible = True
Application.CommandBars("Formatting").Visible = True

End Sub


With the HideToolbars & ShowToolbars run a command for each toolbar available.

Then add this code to the Workbook

Private Sub Workbook_Open()

VisibleSheets
HideScrolls
HideToolbars

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)

ShowScrolls
ShowToolbars

End Sub


This will hide everything you want on open and show again when the workbook is closed.

Hope it works!
Alix