Toolbars Disable/Enable

  • Thread starter Thread starter skrol
  • Start date Start date
S

skrol

Hi,

I have a workbook that works under "allmost" FullScreen.
On opening it, or Activate, is "throws out" (hides) all the toolbars
with:

' Dimension a loop variable.
Dim i As Integer
' Loop through the total number of toolbars.
For i = 1 To Application.Toolbars.Count
' Hide each toolbar.
Application.Toolbars(i).Visible = False
' End of loop.
Next i

Only The Menu bar remains.
Now, when Closing (or Deactivate) this workbook I want to restore some
toolbars.

Application.DisplayFormulaBar = True
Application.DisplayStatusBar = True

works just fine for the Formula and Status bars.

But I can't manage the Standard/Formatting/Drawing bars.

I think the problem is because I work with the Portuguese XP version.
Drawing = "Desenho" / Standard = "Padrao" etc.
But even using these terms doesn't resolve.
And anyway, I want that even with XP in Swahili my workbook can be
used.

Question: Must I use int. ID codes for these bars ??

Regards

S.Krol :confused: / :)
 
Try this instead


Option Explicit


Private mFormulaBar


Private Sub Workbook_Activate()
Dim oCB As CommandBar


'Remove commandbars
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next


'RemoveFormulaBar
mFormulaBar = Application.DisplayFormulaBar
Application.DisplayFormulaBar = False
End Sub


Private Sub Workbook_Deactivate()
Dim oCB As CommandBar


'Restore commandbars
For Each oCB In Application.CommandBars
oCB.Enabled = True
Next


'RestoreFormulaBar
Application.DisplayFormulaBar = mFormulaBar
End Sub


'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code
 
Back
Top