Thread: Startup
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Startup

Tanya,
this should do what you want:
When workbook opens and assuming user enables macros toolbars except menubar
will not be visible.
When you close workbook, all should be restored.

Hope useful

'place code in Thisworkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Restore Bars
HideBars (xlOff)
End Sub

'place code in Thisworkbook
Private Sub Workbook_Open()
'Hide Bars
HideBars (xlOn)
End Sub

'place this code in normal module
Sub HideBars(state)
Static myoldbars As New Collection
Dim mybar

If state = xlOn Then
For Each mybar In Application.CommandBars
If mybar.Type < 1 And mybar.Visible Then
myoldbars.Add mybar
mybar.Visible = False
End If
Next mybar

Else
'restore bars
For Each mybar In myoldbars
mybar.Visible = True
Next

End If
End Sub


--
JB


"Tanya" wrote:

Hi
Is it possible to have only the menubar visible on startup with an Excel
workbook? if so what would the script look like?
cheers
Tanya