+ Reply to Thread
Results 1 to 7 of 7

Add divider lines and sub-menu to right-click menu

  1. #1
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Add divider lines and sub-menu to right-click menu

    I am using some great code that I found on the net and have modified a bit, to create my own right-click menu.

    I would like to add some divider lines to the menu and also some sub-menus.

    How would I be able to go about this with this code?

    Please Login or Register  to view this content.
    Thanks!

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Add divider lines and sub-menu to right-click menu

    you've gotta use the BeginGroup property of the control to add a dividing line before it and specify the control type as msocontrolpopup to be able to add controls to it as a submenu
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: Add divider lines and sub-menu to right-click menu

    Quote Originally Posted by JosephP View Post
    you've gotta use the BeginGroup property of the control to add a dividing line before it and specify the control type as msocontrolpopup to be able to add controls to it as a submenu
    Thanks Joseph for helping out!
    Well doing searches hasn't helped so far, so I tried a couple of things.

    First I tried to insert the .BeginGroup right inside the vArr statement. That gave an error.

    The last thing I tried was cutting up the array line like this:
    Please Login or Register  to view this content.
    Unfortunately this resulted in me losing the top half of the menu and being left with no separator, just the bottom half of the menu.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Add divider lines and sub-menu to right-click menu

    here's a basic example with arrays for the faceids, control types, groupings and parent items
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: Add divider lines and sub-menu to right-click menu

    Quote Originally Posted by JosephP View Post
    here's a basic example with arrays for the faceids, control types, groupings and parent items
    Please Login or Register  to view this content.
    Thanks very much Joseph this has been a huge help to me!
    I have been messing around with different values to see how things work.

    For now I will stick with just one level for the menu and later I'll possibly add a sub-level.
    I have a couple of questions.

    All of my menu items have code linked to them that executes when they are clicked.
    There is one menu item that acts differently however.
    The first menu item will execute when I simply hover the mouse over it!

    Can you explain why this happens?

    Also, my first menu item is showing an arrow, which usually would display a sub-level item.
    But I don't have a sub-level item.
    Can you check my code and tell me why the arrow is showing for this sub-level?

    Please Login or Register  to view this content.

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Add divider lines and sub-menu to right-click menu

    you need to change the first item in vType from msoControlPopup to msoControlButton ;-)

  7. #7
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: Add divider lines and sub-menu to right-click menu

    Quote Originally Posted by JosephP View Post
    you need to change the first item in vType from msoControlPopup to msoControlButton ;-)
    Thanks Joseph. I had tried that before but it didn't work, probably because I had more than one mistake in the code. Now it works.

    I am coming along nicely now. I just have a couple of problems that still need fixing.

    When I hover my mouse over Copy/Paste (which opens the sub-menus) and then I move the mouse over Del/Ins I get an error 400 message.
    If I do the reverse I also get the error 400 message.

    And I also get the error 400 message sometimes when I simply hover my mouse over either of these two menu items (Copy/Paste or Del/Ins).

    I have put in an errortrap at the bottom of my code but it is not helping me find out the problem. I just get error 400.

    I am posting my current test code below:

    Please Login or Register  to view this content.

+ 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. A macro to right click a cell and select a item from the right click menu?
    By Peavey in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2014, 10:55 AM
  2. Right-Click Menu
    By akq125 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-06-2011, 02:30 PM
  3. Excel left click produces right click menu
    By Shoesuntied in forum Excel General
    Replies: 4
    Last Post: 08-18-2006, 01:20 PM
  4. Name of Right Click Menu
    By Desert Piranha in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2006, 04:42 AM
  5. Add menu item to right-click menu
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2006, 05:35 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