Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i save a custom footer in the excel drop down menu? JohnJ Excel Discussion (Misc queries) 4 September 20th 05 08:37 PM
custom menu doesn't drop down via shortcut mpa[_2_] Excel Programming 1 November 18th 04 06:01 PM
custom menu doesn't drop down via shortcut mpa Excel Programming 2 November 18th 04 05:40 PM
custom menu doesn't drop down via shortcut mpa[_3_] Excel Programming 0 November 18th 04 05:36 PM
Custom Menu return to Excel Menu upon Closing VetcalcReport Excel Programming 2 August 2nd 04 02:59 PM


All times are GMT +1. The time now is 03:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"