#1   Report Post  
Iain
 
Posts: n/a
Default Hiding all toolbars

Hi,

Is there a way to hide all toolbars in a particular workbook, that will not
effect any other excel files, even if they are open at the same time?

If possible, I want to hide absolutely everything, including the menu bar.

Cheers,


  #2   Report Post  
Rowan
 
Posts: n/a
Default

You could use the workbook activate and deactivate events.

First add a new worksheet called TB. Then paste the following code into the
workbook code sheet - right click on the Excel Logo to the left of File menu
and select view code to get to the workbook code sheet. The code keeps track
of which toolbars were displayed so that these can be restored when you
deactivate the book. You can't hide the Menu Bar completely (I don't think)
but you can delete all the menu items off it.

Hope this helps
Rowan

Private Sub Workbook_Activate()

Dim tbSheet As Worksheet
Dim tbCount As Integer
Dim tb As CommandBar
Dim ctr As CommandBarPopup

Set tbSheet = Sheets("TB")
tbSheet.Range("A:A").ClearContents
tbSheet.Visible = xlSheetHidden

tbCount = 0
For Each tb In Application.CommandBars
If tb.Type = msoBarTypeNormal Then
If tb.Visible Then
tbCount = tbCount + 1
tbSheet.Cells(tbCount, 1).Value = tb.Name
tb.Visible = False
End If
End If
Next tb

For Each ctr In Application.CommandBars(1).Controls
ctr.Delete
Next ctr

Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False


End Sub

Private Sub Workbook_Deactivate()

Dim tbCount As Integer
Dim tb As String
Dim tbSheet As Worksheet
Set tbSheet = Sheets("TB")

tbCount = 1
tb = tbSheet.Cells(tbCount, 1).Value
Do While tb < ""
Application.CommandBars(tb).Visible = True
tbCount = tbCount + 1
tb = tbSheet.Cells(tbCount, 1).Value
Loop

Application.CommandBars(1).Reset
Application.DisplayStatusBar = True
Application.DisplayFormulaBar = True

End Sub


"Iain" wrote:

Hi,

Is there a way to hide all toolbars in a particular workbook, that will not
effect any other excel files, even if they are open at the same time?

If possible, I want to hide absolutely everything, including the menu bar.

Cheers,


  #3   Report Post  
Mike
 
Posts: n/a
Default

Rowan
I have copied your code and it works.
However it also places the Formula bar and the status bar when I open up my
next workbook - both of which are never visible when I exit excel. so either
your code is memerisong something which isn't there or is placing the
toolbars on exiting.
Any ideas how to stop this ?
Mike

"Rowan" wrote:

You could use the workbook activate and deactivate events.

First add a new worksheet called TB. Then paste the following code into the
workbook code sheet - right click on the Excel Logo to the left of File menu
and select view code to get to the workbook code sheet. The code keeps track
of which toolbars were displayed so that these can be restored when you
deactivate the book. You can't hide the Menu Bar completely (I don't think)
but you can delete all the menu items off it.

Hope this helps
Rowan

Private Sub Workbook_Activate()

Dim tbSheet As Worksheet
Dim tbCount As Integer
Dim tb As CommandBar
Dim ctr As CommandBarPopup

Set tbSheet = Sheets("TB")
tbSheet.Range("A:A").ClearContents
tbSheet.Visible = xlSheetHidden

tbCount = 0
For Each tb In Application.CommandBars
If tb.Type = msoBarTypeNormal Then
If tb.Visible Then
tbCount = tbCount + 1
tbSheet.Cells(tbCount, 1).Value = tb.Name
tb.Visible = False
End If
End If
Next tb

For Each ctr In Application.CommandBars(1).Controls
ctr.Delete
Next ctr

Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False


End Sub

Private Sub Workbook_Deactivate()

Dim tbCount As Integer
Dim tb As String
Dim tbSheet As Worksheet
Set tbSheet = Sheets("TB")

tbCount = 1
tb = tbSheet.Cells(tbCount, 1).Value
Do While tb < ""
Application.CommandBars(tb).Visible = True
tbCount = tbCount + 1
tb = tbSheet.Cells(tbCount, 1).Value
Loop

Application.CommandBars(1).Reset
Application.DisplayStatusBar = True
Application.DisplayFormulaBar = True

End Sub


"Iain" wrote:

Hi,

Is there a way to hide all toolbars in a particular workbook, that will not
effect any other excel files, even if they are open at the same time?

If possible, I want to hide absolutely everything, including the menu bar.

Cheers,


  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Dim sStatusBar
Dim sFormulaBar

Private Sub Workbook_Activate()

Dim tbSheet As Worksheet
Dim tbCount As Integer
Dim tb As CommandBar
Dim ctr As CommandBarPopup

Set tbSheet = Sheets("TB")
tbSheet.Range("A:A").ClearContents
tbSheet.Visible = xlSheetHidden

tbCount = 0
For Each tb In Application.CommandBars
If tb.Type = msoBarTypeNormal Then
If tb.Visible Then
tbCount = tbCount + 1
tbSheet.Cells(tbCount, 1).Value = tb.Name
tb.Visible = False
End If
End If
Next tb

For Each ctr In Application.CommandBars(1).Controls
ctr.Delete
Next ctr

sStatusBar = Application.DisplayStatusBar
sFormulaBar = Application.DisplayFormulaBar
Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False


End Sub

Private Sub Workbook_Deactivate()

Dim tbCount As Integer
Dim tb As String
Dim tbSheet As Worksheet
Set tbSheet = Sheets("TB")

tbCount = 1
tb = tbSheet.Cells(tbCount, 1).Value
Do While tb < ""
Application.CommandBars(tb).Visible = True
tbCount = tbCount + 1
tb = tbSheet.Cells(tbCount, 1).Value
Loop

Application.CommandBars(1).Reset
Application.DisplayStatusBar = sStatusBar
Application.DisplayFormulaBar = sFormulaBar

End Sub

--

HTH

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


"Mike" wrote in message
...
Rowan
I have copied your code and it works.
However it also places the Formula bar and the status bar when I open up

my
next workbook - both of which are never visible when I exit excel. so

either
your code is memerisong something which isn't there or is placing the
toolbars on exiting.
Any ideas how to stop this ?
Mike

"Rowan" wrote:

You could use the workbook activate and deactivate events.

First add a new worksheet called TB. Then paste the following code into

the
workbook code sheet - right click on the Excel Logo to the left of File

menu
and select view code to get to the workbook code sheet. The code keeps

track
of which toolbars were displayed so that these can be restored when you
deactivate the book. You can't hide the Menu Bar completely (I don't

think)
but you can delete all the menu items off it.

Hope this helps
Rowan

Private Sub Workbook_Activate()

Dim tbSheet As Worksheet
Dim tbCount As Integer
Dim tb As CommandBar
Dim ctr As CommandBarPopup

Set tbSheet = Sheets("TB")
tbSheet.Range("A:A").ClearContents
tbSheet.Visible = xlSheetHidden

tbCount = 0
For Each tb In Application.CommandBars
If tb.Type = msoBarTypeNormal Then
If tb.Visible Then
tbCount = tbCount + 1
tbSheet.Cells(tbCount, 1).Value = tb.Name
tb.Visible = False
End If
End If
Next tb

For Each ctr In Application.CommandBars(1).Controls
ctr.Delete
Next ctr

Application.DisplayStatusBar = False
Application.DisplayFormulaBar = False


End Sub

Private Sub Workbook_Deactivate()

Dim tbCount As Integer
Dim tb As String
Dim tbSheet As Worksheet
Set tbSheet = Sheets("TB")

tbCount = 1
tb = tbSheet.Cells(tbCount, 1).Value
Do While tb < ""
Application.CommandBars(tb).Visible = True
tbCount = tbCount + 1
tb = tbSheet.Cells(tbCount, 1).Value
Loop

Application.CommandBars(1).Reset
Application.DisplayStatusBar = True
Application.DisplayFormulaBar = True

End Sub


"Iain" wrote:

Hi,

Is there a way to hide all toolbars in a particular workbook, that

will not
effect any other excel files, even if they are open at the same time?

If possible, I want to hide absolutely everything, including the menu

bar.

Cheers,




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
How to reset Excel 2000 toolbars to "factory defaults"? [email protected] Excel Discussion (Misc queries) 3 March 28th 05 10:39 PM
Saving Customized Toolbars in Excel 2003 MIKE MEDLIN Excel Discussion (Misc queries) 5 January 13th 05 02:03 AM
Customizing ToolBars MIKE MEDLIN Excel Discussion (Misc queries) 0 January 13th 05 12:11 AM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM
Cant add an icon to toolbars Rasoul Khoshravan Azar Excel Discussion (Misc queries) 1 November 28th 04 08:19 PM


All times are GMT +1. The time now is 06:46 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"