How to identify active Menu Bars

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need a sub procedure that identifies all active Menu Bars when opening a
workbook.

- Then store the ID
- disable all found Menus
- active a customized Menu (That works already)

before closing Workbook:
- disable customized Menu (That works already)
- enable alle menus that was active in the beginning

I tried something with .findcontrols but I coudn't get it running.

Thanks!!
 
Option Explicit

Private mFormulaBar

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = True
Next oCB

Application.DisplayFormulaBar = mFormulaBar
End Sub

Private Sub Workbook_Open()
Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next oCB

mFormulaBar = Application.DisplayFormulaBar
Application.DisplayFormulaBar = False
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

(replace somewhere in email address with gmail if mailing direct)
 
Hey Bob

you are great! Perfect - just copy paste....
Thanks for the sunday highlight in VBA :-)
Matz
 

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