Results 1 to 4 of 4

can't find macro custom right click menu

This is a discussion on can't find macro custom right click menu within the Excel Questions forums, part of the Question Forums category; Hi, Creating custom right click menu options, but having issues finding the macro that I'm trying to call. The following ...

  1. #1
    Board Regular
    Join Date
    Jan 2009
    Location
    London
    Posts
    153

    Default can't find macro custom right click menu

    Hi,

    Creating custom right click menu options, but having issues finding the macro that I'm trying to call.

    The following is added to VBA personal.xls ThisWorkbook:

    Code:
     
    Option Explicit
    Private Sub Workbook_Open()
    application.CommandBars("Cell").Reset
    With application.CommandBars("cell").Controls
        With .Add
             .Caption = "&Retrieve"
             .OnAction = "!RetrieveEssbase"
             .Tag = "Retrieve essbase for selection"
             .BeginGroup = True
        End With
        
        With .Add
             .Caption = "Paste &Values"
             .OnAction = "!PasteonlyValues"
             .Tag = "Paste Special Values"
        End With
    End With
    End Sub
    I then have the following in Cell_Menu module:

    Code:
     
     
    Sub PasteonlyValues()
    selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    End Sub
    The macros are added to the right click menu, and the Essbaseretrieve works fine, but when I click the paste special values option, it says it can't find the macro

    any ideas why this wouldn't be working?

    Thanks,
    Martin

  2. #2
    MrExcel MVP
    Moderator
    Andrew Poulsom's Avatar
    Join Date
    Jul 2002
    Posts
    58,831

    Default Re: can't find macro custom right click menu

    If RetrieveEssbase is working why don't you put PasteonlyValues in the same module?
    Microsoft MVP - Excel

  3. #3
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    Behind you
    Posts
    18,918

    Default Re: can't find macro custom right click menu

    or change the OnAction to
    Code:
    .OnAction = "Cell_Menu.PasteonlyValues"
    Rory
    Microsoft MVP - Excel.

    Questions are the cure for ignorance

  4. #4
    Board Regular
    Join Date
    Jan 2009
    Location
    London
    Posts
    153

    Default Re: can't find macro custom right click menu

    Thanks Rorya, adding the cell_menu. seemed to do the trick

    Strange, I already had the paste special code in the same module as the essbase retrieve, however I don't have to add the cell_menu to the later. Not sure why but it is working now so thanks alot

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
  •  


DMCA.com