Results 1 to 11 of 11

Thread: shortcut menus

  1. #1
    New Lounger
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    shortcut menus

    w2000,office97. My right click menus seem to get reset if I click a selection that spans an entire row. How to I stop Excel from performing this reset? I tried cancel=yes, but that kills the display of the menu altogether. How can I trigger the display of the shortcut menu at that point?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    Can you tell us what you mean by reset? In my Excel 97, the right click menu is different if I right click on an entire row selection rather than a single cell. However, the changes remove things that don't make sense in the different contexts and adds things that do. However, there is a pop up context menu for both.
    Legare Coleman

  3. #3
    New Lounger
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    my code adds eight new options to the shortcut menu on this worksheet whenever there is a rightclick event. If I right click anywhere but on an "entirerow" selection, it shows what I want: the MS options plus my eight additional ones. But when I click on such a selection, all of my eight options just don't appear at all and I get the standard shortcut menu. So it looks like MS has "reset" the shortcut menu when it sees the entirerow selection.

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    Could you place a call to whatever routine initialises the right click menu in the workbook SheetBeforeRightClick e,g, :-

    Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
    <font color=448800>Call Right_Click_Menu</font color=448800>
    End Sub

    That code should be placed in the Workbook object, as opposed to a module.

    Andrew C

  5. #5
    New Lounger
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    In the module for the worksheet I use:
    Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean)
    Call Module1.SiteMapSetMenu
    End Sub
    I do not have any charts, so simple BeforeRightClick call should work. So you see, my shortcut routine is executed, but then it seems to get reset because MS is noticing that there is a full row selected and it does something different than normal. I wish I knew the program that MS executes as the "normal" response to a rightclick, so I could "cancel" this one, run my own routine and follow it with a call to the standard MS display, but I can't find that routine anywhere in the help.

  6. #6
    New Lounger
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    Andrew, did you mean that the actual SiteMapSetMenu program needs to be in the worksheet area rather than a module? If so, that is peculiar, as it always works the way I have it now EXCEPT when I first select an entire row and then right click within that selection.

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    Would you mind posting a copy of the workbook, blank except for the routine that sets up the custom menu.

    It is difficult to say exactly, without knowing the structure of the workbook. I just thought that when you right click on a worksheet, the menu could be re - initialised, if there was a call to it. It was just a suggestion to try a workaround to your problem. Actually, if you are going to try it, you should place it in the Workbook object (Workbook_SheetBeforeRightClick) , at it will then operate for all sheets.

    Andrew

  8. #8
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    Did you put your selections in the shortcut menu for the Whole Row selected context? There are different context menues for each possible context. Putting your commands in one of them will not put them in all of them.
    Legare Coleman

  9. #9
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: shortcut menus

    Hi,
    I think Legare is right - certainly in Excel 2000 there are (at least) 3 separate right-click menus. Commandbar 23 is what appears if you right-click a cell (or group of cells), commandbar 24 appears if you right-click an entire column and commandbar 25 if you right-click an entire row. So Excel is not resetting your custom menu - it's just not displaying it. If you need your menu items to appear in all circumstances, I'd suggest adding them to all three commandbars.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  10. #10
    New Lounger
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    Thanks for your input. I think you are exactly right that there are three different menus that MS uses based on context of the selection. Do you know of any way for me to test which context I am in so I know what menu is about to be displayed? Or should I just change all of them?

  11. #11
    New Lounger
    Join Date
    Jun 2008
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: shortcut menus

    Well, I answered my own question this time: I can just check the selections. Thanks your help, all of you.

Posting Permissions

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