Hide And Un-hide Excel Toolbars

  • Thread starter Thread starter Jim333
  • Start date Start date
J

Jim333

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
 
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
 
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,
 
Compile error?

Pls mail me so I have your email address

DM Unseen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top