+ Reply to Thread
Results 1 to 5 of 5

creating new custom menu items

  1. #1
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    creating new custom menu items

    I have the code below which I use to create a custom menu that runs on workbook opening and is removed on workbook closing. this works fine but I would like to have some items (such as expand and collapse below) as single button that will activate the relevent subroutine. I have tried what I thought to be the obvious solution of simply creating custom buttons and assigning a macro to them. This works fine but they appear on all workbooks I open which I don't want so I went down the road of adapting the custom menu code below. The menu 'mytag' works fine, so I added 'mytag2' and 'mytag3'. (at the bottom of the code)
    The menu's build and remove on workbook opening and closing and on the first click of the mouse on either expand or collapse it initiates the macro correctly. However after the first click the macros are run as soon as the mouse runs over the menu rather than when it is clicked.
    Can you suggest a solution to this or possibly a better option of building custom buttons on workbook open and removing them on close

    Please Login or Register  to view this content.
    Last edited by tryer; 12-03-2010 at 10:49 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: creating new custom menu items

    If you want buttons, you should specify msoControlButton rather than msoControlPopup when you add the controls. Your 'expand' control is actually the original 'Report menu' popup which you are overwriting.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    Re: creating new custom menu items

    Thank for the reply Romperstomper. I have tried experimenting with this and used the test code below but this does not create and menu items.
    If I use msoControlPopup the menu items do appear
    Please Login or Register  to view this content.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: creating new custom menu items

    That will create two buttons on the main menu bar, but you probably won't see them as they don't have icons and the default view is icon only. You need to specify the style to see the captions:
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    Re: creating new custom menu items

    That's sorted it

    Thank you very much for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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