Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Hide all Excel tool/command bars except mine and reload on close

Howdy
Hopefully the subject line says it all, but I'm wondering if it's at all
possible to, when my workbook is opened or activated, hide all toolbars
except the one created in my workbook, and then on close of my workbook or
deactivation of it, to show all previously visible command bars?
Obviously I don't want to muck up any user's existing toolbar setup, so is
it possible to do what I want with this in mind too?
Anyone got some sample code?
Thanks
Matt


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Hide all Excel tool/command bars except mine and reload on close

Hi Matt,

Here are a couple of routines. Just change Standard for your toolbar name.

Dim colCBs As Collection

Sub HideEm()
Dim oCB As CommandBar

Set colCBs = New Collection
For Each oCB In Application.CommandBars
If oCB.Name < "Standard" Then
If oCB.Visible Then
colCBs.Add oCB.Name
If oCB.Name = "Worksheet Menu Bar" Then
oCB.Enabled = False
Else
oCB.Visible = False
End If
End If
End If
Next oCB

End Sub


Sub ShowEm()
Dim i As Long

For i = 1 To colCBs.Count
If colCBs.Item(i) = "Worksheet Menu Bar" Then
Application.CommandBars(colCBs.Item(i)).Enabled = True
Else
Application.CommandBars(colCBs.Item(i)).Visible = True
End If
Next i

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Howdy
Hopefully the subject line says it all, but I'm wondering if it's at all
possible to, when my workbook is opened or activated, hide all toolbars
except the one created in my workbook, and then on close of my workbook or
deactivation of it, to show all previously visible command bars?
Obviously I don't want to muck up any user's existing toolbar setup, so is
it possible to do what I want with this in mind too?
Anyone got some sample code?
Thanks
Matt




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Hide all Excel tool/command bars except mine and reload on close

Cheers Bob
Matt

"Bob Phillips" wrote in message
...
Hi Matt,

Here are a couple of routines. Just change Standard for your toolbar name.

Dim colCBs As Collection

Sub HideEm()
Dim oCB As CommandBar

Set colCBs = New Collection
For Each oCB In Application.CommandBars
If oCB.Name < "Standard" Then
If oCB.Visible Then
colCBs.Add oCB.Name
If oCB.Name = "Worksheet Menu Bar" Then
oCB.Enabled = False
Else
oCB.Visible = False
End If
End If
End If
Next oCB

End Sub


Sub ShowEm()
Dim i As Long

For i = 1 To colCBs.Count
If colCBs.Item(i) = "Worksheet Menu Bar" Then
Application.CommandBars(colCBs.Item(i)).Enabled = True
Else
Application.CommandBars(colCBs.Item(i)).Visible = True
End If
Next i

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Howdy
Hopefully the subject line says it all, but I'm wondering if it's at all
possible to, when my workbook is opened or activated, hide all toolbars
except the one created in my workbook, and then on close of my workbook

or
deactivation of it, to show all previously visible command bars?
Obviously I don't want to muck up any user's existing toolbar setup, so

is
it possible to do what I want with this in mind too?
Anyone got some sample code?
Thanks
Matt






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
Excel crash reload close 302blue_eyes Excel Discussion (Misc queries) 5 April 10th 08 01:44 PM
Can I move Excel 2007 tool bars to the bottom of screen or get rid John Scinto Excel Discussion (Misc queries) 1 August 20th 07 06:17 AM
Excel Tool Bars baileybw New Users to Excel 4 July 25th 06 04:58 AM
Menu & tool bars in Excel vanish after using display manager power Sarah K Excel Discussion (Misc queries) 1 March 6th 06 05:50 PM
Lost all my menu bars and tool bars CathyJ Excel Discussion (Misc queries) 3 August 8th 05 12:49 PM


All times are GMT +1. The time now is 05:41 PM.

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"