#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default toolbars

Hello

How can I make all the toolbars & menu bars disappear when
I open a particular workbook, but re-appear when the
workbook is closed?

I'm not sure if it's possible to do this for one workbook
or whether it has to apply to the whole application.
Applying to an individual workbook would be good.

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default toolbars

There is no applying. You have to write the code in the appropriate events
to loop through all the toolbars and set the visible property to false
(except commandbars 1 and 2 which have to be disabled), and then restore
them when appropriate.

--
Regards,
Tom Ogilvy

"POPPY" wrote in message
...
Hello

How can I make all the toolbars & menu bars disappear when
I open a particular workbook, but re-appear when the
workbook is closed?

I'm not sure if it's possible to do this for one workbook
or whether it has to apply to the whole application.
Applying to an individual workbook would be good.

thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default toolbars

Thanks Tom
Do you know what the code would be to do that?
I'm not sure how to refer to the different toolbars in vba.

thanks
-----Original Message-----
There is no applying. You have to write the code in the

appropriate events
to loop through all the toolbars and set the visible

property to false
(except commandbars 1 and 2 which have to be disabled),

and then restore
them when appropriate.

--
Regards,
Tom Ogilvy

"POPPY" wrote in

message
...
Hello

How can I make all the toolbars & menu bars disappear

when
I open a particular workbook, but re-appear when the
workbook is closed?

I'm not sure if it's possible to do this for one

workbook
or whether it has to apply to the whole application.
Applying to an individual workbook would be good.

thanks



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default toolbars

Here is an example

Dim aryCBs

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim i As Long
For i = LBound(aryCBs, 1) To UBound(aryCBs, 1)
Application.CommandBars(aryCBs(i)).visible = True
Next i
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub

Private Sub Workbook_Open()
Dim cb As CommandBar
Dim j As Long

Application.CommandBars("Worksheet Menu Bar").Enabled = False
For Each cb In Application.CommandBars
If cb.Name < "Worksheet Menu Bar" Then
If cb.visible = True Then
If j = 0 Then
ReDim aryCBs(0)
Else
ReDim Preserve aryCBs(j)
End If
aryCBs(j) = cb.Name
cb.visible = False
j = j + 1
End If
End If
Next cb

End Sub

Goes in the ThisWorkbook code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"POPPY" wrote in message
...
Thanks Tom
Do you know what the code would be to do that?
I'm not sure how to refer to the different toolbars in vba.

thanks
-----Original Message-----
There is no applying. You have to write the code in the

appropriate events
to loop through all the toolbars and set the visible

property to false
(except commandbars 1 and 2 which have to be disabled),

and then restore
them when appropriate.

--
Regards,
Tom Ogilvy

"POPPY" wrote in

message
...
Hello

How can I make all the toolbars & menu bars disappear

when
I open a particular workbook, but re-appear when the
workbook is closed?

I'm not sure if it's possible to do this for one

workbook
or whether it has to apply to the whole application.
Applying to an individual workbook would be good.

thanks



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default toolbars

Great!
Thanks Bob :o)
-----Original Message-----
Here is an example

Dim aryCBs

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim i As Long
For i = LBound(aryCBs, 1) To UBound(aryCBs, 1)
Application.CommandBars(aryCBs(i)).visible = True
Next i
Application.CommandBars("Worksheet Menu Bar").Enabled

= True
End Sub

Private Sub Workbook_Open()
Dim cb As CommandBar
Dim j As Long

Application.CommandBars("Worksheet Menu Bar").Enabled

= False
For Each cb In Application.CommandBars
If cb.Name < "Worksheet Menu Bar" Then
If cb.visible = True Then
If j = 0 Then
ReDim aryCBs(0)
Else
ReDim Preserve aryCBs(j)
End If
aryCBs(j) = cb.Name
cb.visible = False
j = j + 1
End If
End If
Next cb

End Sub

Goes in the ThisWorkbook code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"POPPY" wrote in

message
...
Thanks Tom
Do you know what the code would be to do that?
I'm not sure how to refer to the different toolbars in

vba.

thanks
-----Original Message-----
There is no applying. You have to write the code in

the
appropriate events
to loop through all the toolbars and set the visible

property to false
(except commandbars 1 and 2 which have to be disabled),

and then restore
them when appropriate.

--
Regards,
Tom Ogilvy

"POPPY" wrote in

message
...
Hello

How can I make all the toolbars & menu bars disappear

when
I open a particular workbook, but re-appear when the
workbook is closed?


I'm not sure if it's possible to do this for one

workbook
or whether it has to apply to the whole application.
Applying to an individual workbook would be good.

thanks


.



.

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
Toolbars Sarah at DaVita Excel Discussion (Misc queries) 1 January 23rd 08 02:43 AM
Toolbars barrowhill Excel Discussion (Misc queries) 3 November 25th 05 01:51 PM
ToolBars bach New Users to Excel 5 August 11th 05 11:10 AM
Toolbars Randal W. Hozeski Excel Programming 6 January 2nd 04 04:48 PM
toolbars devnext Excel Programming 2 October 28th 03 01:50 PM


All times are GMT +1. The time now is 02:16 AM.

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

About Us

"It's about Microsoft Excel"