ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide And Un-hide Excel Toolbars (https://www.excelbanter.com/excel-programming/333137-hide-un-hide-excel-toolbars.html)

Jim333[_4_]

Hide And Un-hide Excel Toolbars
 

Hi everybody,

Is there any code to hide all toolbars when opening the workbook and
unhide them when closing the workbook,

I have one code for that purpose, but the problem with it is that I
have to mention all toolbars names in the code to hide or unhide them,
and when any toolbar is not mentioned in the code, it will not be
hidden or unhidden.

I hope that my question is clear for all,

Thankyou


--
Jim333
------------------------------------------------------------------------
Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186
View this thread: http://www.excelforum.com/showthread...hreadid=383090


DM Unseen

Hide And Un-hide Excel Toolbars
 
Sub showhide(bHide As Boolean)
Dim cmb As CommandBar
Static col As New Collection

If bHide Then
For Each cmb In Application.CommandBars
If cmb.Type = msoBarTypeMenuBar Or cmb.Type = msoBarTypeNormal Then
If cmb.Visible Then
cmb.Visible = False
cmb.Enabled = False
col.Add cmb, cmb.Name
End If
End If
Next cmb
Else
For Each cmb In col
cmb.Visible = True
cmb.Enabled = True
Next cmb
Set col = Nothing
End If


End Sub

DM Unseen


Jim333[_5_]

Hide And Un-hide Excel Toolbars
 

Hi,

Thank you so much for ur reply,

I tried to install the code in a workbook, but It didn't work so, I
would like u please to put it in a workbook and attach it.

Thanx,


--
Jim333
------------------------------------------------------------------------
Jim333's Profile: http://www.excelforum.com/member.php...fo&userid=5186
View this thread: http://www.excelforum.com/showthread...hreadid=383090


DM Unseen

Hide And Un-hide Excel Toolbars
 
Compile error?

Pls mail me so I have your email address

DM Unseen



All times are GMT +1. The time now is 01:10 PM.

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