Results 1 to 5 of 5

Thread: Custom Pull-Down Menu in Excel

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Custom Pull-Down Menu in Excel

    I'm sure I read here somewhere recently that you can't replace the default pull-down menus in Excel, but rather "overlay" your custom menus, in affect doing the same thing in the eyes of the user.

    Is this true ?

    I want to either replace or "overlay" pull-down menus in Excel, but am not really very up to speed in this area.

    Can anyone offer any help ?

    Thanks

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Custom Pull-Down Menu in Excel

    You can find the control and set its visibility property to false and then add
    your own custom one in the same place in the toolbar, etc. Use the .Find
    method of the commandbars collection for the desired toolbar.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: Custom Pull-Down Menu in Excel

    OK that makes about 60% sense to me so far .... but I'll keep snouting about and see what I can do.

    Thanks again Rob

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Custom Pull-Down Menu in Excel

    I wrote a small example for you. What it does is hide the standard save
    menu item. Then it creates a new "Save Me" menu item in its place. I added
    an event for it too that just shows a msgbox.

    VB Code:
    1. Option Explicit
    2.  
    3. Public WithEvents oCBBCustom As Office.CommandBarButton
    4.  
    5. Private Sub oCBBCustom_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
    6.     MsgBox "Save Me!"
    7. End Sub
    8.  
    9. Private Sub Workbook_Open()
    10.     Dim oCB As Office.CommandBar
    11.     Dim oCBBFile As Office.CommandBarPopup
    12.     Dim oCBBSave As Office.CommandBarButton
    13.     Set oCB = Application.CommandBars("Worksheet Menu Bar")
    14.     Set oCBBFile = oCB.Controls("&File")
    15.     Set oCBBSave = oCBBFile.Controls("&Save")
    16.     oCBBSave.Visible = False
    17.     Set oCBBCustom = oCBBFile.Controls.Add(msoControlButton, 1, , 5, True)
    18.     With oCBBCustom
    19.         .Caption = "Save Me"
    20.         .BeginGroup = False
    21.         .Enabled = True
    22.         .Visible = True
    23.     End With
    24.     'oCB.Reset 'To reset the menu.
    25. End Sub
    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: Custom Pull-Down Menu in Excel

    Thanks a lot Rob ... much appreciated

Posting Permissions

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



Click Here to Expand Forum to Full Width