Hi Kasmal,

You can hide and unhide the menu for any worksheet with this code in
the worksheet events "Activate" and "Deactivate":

Private Sub Worksheet_Activate()
'To hide
    Application.CommandBars("Your custom menu Name").Enabled = False
End Sub

Private Sub Worksheet_Deactivate()
'To unhide
Application.CommandBars("Your custom menu Name").Enabled = True
End Sub

Regards,
Jonell

On Aug 22, 1:33 am, kamal shah <kamal...@gmail.com> wrote:
> Hi Team,
>
> I wrote piece of code to generate Dropdown Menu and call various Macros from
> it.
> This piece of code makes Menu permanent. My requirement is when User open
> specific WorkBook and in specific Workbook a Specific Sheet, then only
> custom Dropdown menu should appear.
>
> Any help on this will be highly appreciated.
>
> Here is a code I used to create Menu for Macros,
>
> ========================================
> ' GENERATE MENU ITEM WITH NAME AS Macros
> ========================================
>
> Sub AddNewMenu()
> Dim HelpIndex As Integer
> Dim NewMenu As CommandBarPopup
> HelpIndex = CommandBars(1).Controls("Help").Index
> ' CommandBar 1 = Menu
> ' msoControlPopup = builtin constant
> ' Before = Position on Menu
> ' Temporary, if it is True then Menu will be available as long as Excel is
> open,
> '            if "False" then it will permanent.
> ' Menu Name = Macros
> Set NewMenu = CommandBars(1) _
> .Controls.Add(Type:=msoControlPopup, _
> Before:=HelpIndex, Temporary:=False)
> NewMenu.Caption = "&Macros"
> End Sub
>
> ================================
> ' MAcro to add Macros to  Menu
> ============================
> Sub AddMenuItem()
>
> Set Item = CommandBars(1).Controls("Macros").Controls.Add
> ' Macro - Combine
> Item.Caption = "&UpdateAwardValues"
> Item.OnAction = "UpdateAwardValues"
> Item.BeginGroup = True
>
> End Sub
> ===============================
>
> Kamal

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 5,200 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to