+ Reply to Thread
Results 1 to 2 of 2

Disable custom drop-down menu

Hybrid View

  1. #1
    Piers 2k
    Guest

    Disable custom drop-down menu

    Hi folks,

    Have a file on a public drive which is opened by a number of users using Alt
    Startup Location configured in options. Workbook is hidden, and Open and
    BeforeClose events work correctly to create and drop a custom menu. All
    fine.

    Except when no workbooks are open, the menu isn't disabled in any way. Is
    there a way to disable the entire menu or certain items when no other files
    are open?

    TIA,

    Piers



  2. #2
    Bob Phillips
    Guest

    Re: Disable custom drop-down menu

    See if this works for you

    Option Explicit

    Public WithEvents App As Application

    Private Sub App_WindowActivate(ByVal Wb As Workbook, ByVal Wn As Window)
    Dim win As Window
    Dim cnt As Long
    For Each win In Application.Windows
    cnt = cnt - win.Visible
    Next win
    If cnt > 1 Then Application.Commandbars("myMenu").Enabled=True
    End Sub

    Private Sub App_WindowDeactivate(ByVal Wb As Workbook, ByVal Wn As Window)
    Dim win As Window
    Dim cnt As Long
    For Each win In Application.Windows
    cnt = cnt - win.Visible
    Next win
    If cnt = 1 Then Application.Commandbars("myMenu").Enabled=False
    End Sub

    Private Sub Workbook_Open()
    Set App = Application
    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)

    "Piers 2k" <fake@msn.com> wrote in message
    news:egd7epQwGHA.4688@TK2MSFTNGP06.phx.gbl...
    > Hi folks,
    >
    > Have a file on a public drive which is opened by a number of users using

    Alt
    > Startup Location configured in options. Workbook is hidden, and Open and
    > BeforeClose events work correctly to create and drop a custom menu. All
    > fine.
    >
    > Except when no workbooks are open, the menu isn't disabled in any way. Is
    > there a way to disable the entire menu or certain items when no other

    files
    > are open?
    >
    > TIA,
    >
    > Piers
    >
    >




+ 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