+ Reply to Thread
Results 1 to 3 of 3

Groups sub menus on rigtmouseclick

Hybrid View

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    70

    Groups sub menus on rigtmouseclick

    Fellow members of this forum,

    I don't now how to make a group sub menu on a rigtmouseclick.

    I am using the following [CODE}

    Public Sub MuisMenuToevoegen()
    'maak menu klaar voor or make menu
    Call MuisMenuVerwijderen 'call to remove mousemenu rigtmouseclick

    With Application.CommandBars("cell").Controls
    ' Begin group and let first parting line stand

    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Visible = False
    .BeginGroup = True
    End With


    'repeat code between the stars for a next menu item.

    'Use and fill caption an onaction on a good way
    '****************************************************************************************
    'Voeg een nieuw menu item toe

    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Caption = "Start &LKV Formulier" 'text you see with you richtmouseclick
    .OnAction = "ShowFormulier" 'The (sub) routine call
    End With 'between quotes ""

    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Caption = "Pas &Scherm aan"
    .OnAction = "PasSchermAan"
    End With

    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Caption = "Kleur &Record"
    .OnAction = "KleurRij"
    End With

    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Caption = "Start &Zoekscherm"
    .OnAction = "ZoekScherm"
    End With

    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Caption = "Start &HelpScherm"
    .OnAction = "Helpscherm"
    End With

    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Caption = "&Onwaar word NEE"
    .OnAction = "OnWaarWordNee"
    ' .Visible = True
    End With


    With .Add(Type:=msoControlButton, Before:=1, temporary:=True)
    .Caption = "&Waar word JA"
    .OnAction = "WAARWordJa"
    ' .Visible = False
    End With


    '****************************************************************************************
    'Dus hier volgende menu item
    End With
    End Sub

    [CODE]

    This works pure as menu items but how do i get this as a group sub menu parts.
    I need to work with more than one group

    See also the attachment.
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,298

    Re: Groups sub menus on rigtmouseclick

    You need to add a PopUp control first, then add the new controls to that pop-up. Here is the correct structure, but without all your code:

    Public Sub MuisMenuToevoegen2()
        Application.CommandBars("cell").Reset
        'maak menu klaar voor or make menu
        With Application.CommandBars("cell").Controls
            ' Begin group and let first parting line stand
            
            'Add a control POPUP first
            With .Add(Type:=msoControlPopup, Before:=1, temporary:=True)
                .Caption = "My NEW Group!"
            
                'Then add controls to the popup control
                With .Controls.Add(Type:=msoControlButton, Before:=1, temporary:=True)
                    .Caption = "Start &LKV Formulier" 'text you see with you richtmouseclick
                    .OnAction = "ShowFormulier" 'The (sub) routine call
                End With 'between quotes "
                    
                With .Controls.Add(Type:=msoControlButton, Before:=1, temporary:=True)
                    .Caption = "Pas &Scherm aan"
                    .OnAction = "PasSchermAan"
                End With
                    
                'And for the others
                    
            End With
        End With
    End Sub
    Last edited by Bernie Deitrick; 07-20-2017 at 03:44 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    02-20-2013
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Groups sub menus on rigtmouseclick

    Many thanks Bernie i wil try it

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 26
    Last Post: 01-15-2016, 03:38 AM
  2. Replies: 4
    Last Post: 07-22-2015, 07:13 AM
  3. Replies: 0
    Last Post: 10-01-2012, 05:54 AM
  4. How to Add a pop up menus with multiple menus levels
    By elbertvillarreal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-23-2012, 12:36 PM
  5. Analysing groups of cells to form new groups
    By lurker17260 in forum Excel General
    Replies: 3
    Last Post: 02-08-2012, 04:45 PM
  6. [SOLVED] New Menus - attaching but menus are reset
    By Greegan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-05-2005, 11:25 AM

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