+ Reply to Thread
Results 1 to 4 of 4

How to identify active Menu Bars

  1. #1
    Matz
    Guest

    How to identify active Menu Bars

    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!!

  2. #2
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    This is similar...

    This isn't an exact answer to you question, but maybe it can be adapted for your purpose?

    I have since adapted to store in a worksheet array rather tha in a global array, but that code is at work and I will be away from work for several weeks.

    See the following:
    http://www.excelforum.com/showthread.php?t=497189
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  3. #3
    Bob Phillips
    Guest

    Re: How to identify active Menu Bars

    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)

    "Matz" <[email protected]> wrote in message
    news:[email protected]...
    > 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!!




  4. #4
    Matz
    Guest

    Re: How to identify active Menu Bars

    Hey Bob

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

    "Bob Phillips" wrote:

    > 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)
    >
    > "Matz" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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!!

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1