ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toolbars Disable/Enable (https://www.excelbanter.com/excel-programming/341004-toolbars-disable-enable.html)

skrol

Toolbars Disable/Enable
 

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: / :)


--
skrol
------------------------------------------------------------------------
skrol's Profile: http://www.excelforum.com/member.php...o&userid=27126
View this thread: http://www.excelforum.com/showthread...hreadid=470450


Bob Phillips[_6_]

Toolbars Disable/Enable
 
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


--
HTH

Bob Phillips

"skrol" wrote in
message ...

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: / :)


--
skrol
------------------------------------------------------------------------
skrol's Profile:

http://www.excelforum.com/member.php...o&userid=27126
View this thread: http://www.excelforum.com/showthread...hreadid=470450




skrol[_2_]

Toolbars Disable/Enable
 

Thanks Bob,
I'm going to try it.......................

:)


--
skrol
------------------------------------------------------------------------
skrol's Profile: http://www.excelforum.com/member.php...o&userid=27126
View this thread: http://www.excelforum.com/showthread...hreadid=470450



All times are GMT +1. The time now is 12:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com