Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Menu help!


Dear all,

I created a Menu and many submenues on that Menu. However, some
submenues are only for specified worksheets. It means different
submenues are used for different worksheets but all all submenues are
on a Menu in Excel.

Could any one help me to hide or unhide some submenues when user select
a certain worksheet.

Thank you very much

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile: http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=387052

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Excel Menu help!

Rather than hiding and unhiding you can just disable the menu items which are
not appropriate for a particular sheet. They will appear greyed out on the
menu. Do this with worksheet event code by pasting the following on the
sheet's code page. This example disables the DataSort command.

Private Sub Worksheet_Activate()
CommandBars(1).Controls("Data").Controls("Sort..." ).Enabled = False
End Sub


Private Sub Worksheet_Deactivate()
CommandBars(1).Controls("Data").Controls("Sort..." ).Enabled = True
End Sub

Hope this helps
Rowan

"lehainam" wrote:


Dear all,

I created a Menu and many submenues on that Menu. However, some
submenues are only for specified worksheets. It means different
submenues are used for different worksheets but all all submenues are
on a Menu in Excel.

Could any one help me to hide or unhide some submenues when user select
a certain worksheet.

Thank you very much

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile: http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=387052


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Menu help!


Dear Rowan,

Thanks for your advice. However it does not work on my Menu. It onl
works on standard Menu of Excel.

For example: If the index of my menu is 13 and i want to disable 1s
sub menu of my menu, it does not work

Commandbars(1).controls(13).controls(1).disabled=f alse

But for Excel Menu it works,

Commandbars(1).controls(1.controls(1).disabled=fal se

Could you help me!

Thanks,

Na

--
lehaina
-----------------------------------------------------------------------
lehainam's Profile: http://www.excelforum.com/member.php...fo&userid=1861
View this thread: http://www.excelforum.com/showthread.php?threadid=38705

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Excel Menu help!

Use names not index, it is more resilient as index could change, and there
is no Disabled property, just Enabled.

Commandbars("Worksheet Menu
Bar").controls("myMenu").controls("mySubMenu1!).En abled= True

and

Commandbars("Worksheet Menu
Bar").controls("myMenu").controls("mySubMenu1!).En abled= False

--
HTH

Bob Phillips

"lehainam" wrote in
message ...

Dear Rowan,

Thanks for your advice. However it does not work on my Menu. It only
works on standard Menu of Excel.

For example: If the index of my menu is 13 and i want to disable 1st
sub menu of my menu, it does not work

Commandbars(1).controls(13).controls(1).disabled=f alse

But for Excel Menu it works,

Commandbars(1).controls(1.controls(1).disabled=fal se

Could you help me!

Thanks,

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile:

http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=387052



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
Drop dwn menu. Formula to count selection frm menu in anoth cell? ggoldber Excel Worksheet Functions 1 June 4th 08 02:21 PM
Excel -My paste menu is not the norm. The menu is different. wduval1715 Setting up and Configuration of Excel 2 November 3rd 07 07:07 PM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Adding a menu item right click menu when clicking on a single. Andoni[_28_] Excel Programming 0 September 2nd 04 10:23 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 07:55 AM.

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

About Us

"It's about Microsoft Excel"