+ Reply to Thread
Results 1 to 9 of 9

Adding items to right-click menu

  1. #1
    Forum Contributor
    Join Date
    04-13-2006
    Location
    London
    Posts
    102

    Question Adding items to right-click menu

    Hi.

    I have written a short macro to add items to the right-click menu, but am having difficulty finding the right ID numbers. So far, I have managed to add "Paste Values" and "Paste Formatting", as below:

    Sub AddItems()

    'Paste Values
    Application.CommandBars("cell").Controls.Add Type:=msoControlButton, ID:=370, before:=5

    'Paste Formatting
    Application.CommandBars("cell").Controls.Add Type:=msoControlButton, ID:=369, before:=5

    End Sub

    I also want to add the following:
    • Paste Formulas
    • Paste Comments

    But I don't know the relevant ID numbers! Please can anyone tell me what they are?

    Thanks!

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Maybe this link will help with the ID's

    Regards,
    Simon

    http://support.microsoft.com/?kbid=830502

  3. #3
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    The last link may be useful but this one has all the ID's for excel 2000

    Regards,
    Simon

    http://support.microsoft.com/kb/213552/EN-US/

  4. #4
    Forum Contributor
    Join Date
    04-13-2006
    Location
    London
    Posts
    102

    Unhappy

    Thanks Simon, much appreciated, but unfortunately they haven't answered my question.

    You'll notice that the ID numbers I already have, 369 and 370, aren't actually listed in the ID numbers link, so what I really need are absolutely EVERY single ID number possible and what they do. I've had a scan around Microsoft's website, but they aren't there.

    I could try going through every ID in the macro until I find the right ones, but that could take a LONG time!!!

  5. #5
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Sorry thats the best i could do, perhaps send mail to microsoft and ask?

    Worth a go!

    Regards,
    Simon

  6. #6
    RB Smissaert
    Guest

    Re: Adding items to right-click menu

    You don't need any ID's to add to the right-click menu:

    With Application.CommandBars("Cell")
    With .Controls.Add(Type:=msoControlButton)
    .BeginGroup = True
    .Caption = "Change text to numbers in selected sheet range"
    .OnAction = "MakeNumbers"
    .FaceId = 399
    End With
    With .Controls.Add(Type:=msoControlButton)
    .Caption = "Change formula's to values"
    .OnAction = "FormulasToValues"
    .FaceId = 385
    End With
    End With

    etc.

    RBS


    "Cumberland" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi.
    >
    > I have written a short macro to add items to the right-click menu, but
    > am having difficulty finding the right ID numbers. So far, I have
    > managed to add "Paste Values" and "Paste Formatting", as below:
    >
    > Sub AddItems()
    >
    > 'Paste Values
    > Application.CommandBars("cell").Controls.Add Type:=msoControlButton,
    > ID:=370, before:=5
    >
    > 'Paste Formatting
    > Application.CommandBars("cell").Controls.Add Type:=msoControlButton,
    > ID:=369, before:=5
    >
    > End Sub
    >
    > I also want to add the following:
    >
    >
    > - Paste Formulas
    > - Paste Comments
    >
    >
    > But I don't know the relevant ID numbers! Please can anyone tell me
    > what they are?
    >
    > Thanks!
    >
    >
    > --
    > Cumberland
    > ------------------------------------------------------------------------
    > Cumberland's Profile:
    > http://www.excelforum.com/member.php...o&userid=33445
    > View this thread: http://www.excelforum.com/showthread...hreadid=571718
    >



  7. #7
    RB Smissaert
    Guest

    Re: Adding items to right-click menu

    Sorry, ignore this message. I realize you are dealing with built-in actions
    where this is different.
    Still, maybe you could make macro's that do these built-in actions and do it
    as posted.

    RBS

    "RB Smissaert" <[email protected]> wrote in message
    news:[email protected]...
    > You don't need any ID's to add to the right-click menu:
    >
    > With Application.CommandBars("Cell")
    > With .Controls.Add(Type:=msoControlButton)
    > .BeginGroup = True
    > .Caption = "Change text to numbers in selected sheet range"
    > .OnAction = "MakeNumbers"
    > .FaceId = 399
    > End With
    > With .Controls.Add(Type:=msoControlButton)
    > .Caption = "Change formula's to values"
    > .OnAction = "FormulasToValues"
    > .FaceId = 385
    > End With
    > End With
    >
    > etc.
    >
    > RBS
    >
    >
    > "Cumberland" <[email protected]>
    > wrote in message
    > news:[email protected]...
    >>
    >> Hi.
    >>
    >> I have written a short macro to add items to the right-click menu, but
    >> am having difficulty finding the right ID numbers. So far, I have
    >> managed to add "Paste Values" and "Paste Formatting", as below:
    >>
    >> Sub AddItems()
    >>
    >> 'Paste Values
    >> Application.CommandBars("cell").Controls.Add Type:=msoControlButton,
    >> ID:=370, before:=5
    >>
    >> 'Paste Formatting
    >> Application.CommandBars("cell").Controls.Add Type:=msoControlButton,
    >> ID:=369, before:=5
    >>
    >> End Sub
    >>
    >> I also want to add the following:
    >>
    >>
    >> - Paste Formulas
    >> - Paste Comments
    >>
    >>
    >> But I don't know the relevant ID numbers! Please can anyone tell me
    >> what they are?
    >>
    >> Thanks!
    >>
    >>
    >> --
    >> Cumberland
    >> ------------------------------------------------------------------------
    >> Cumberland's Profile:
    >> http://www.excelforum.com/member.php...o&userid=33445
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=571718
    >>

    >



  8. #8
    NickHK
    Guest

    Re: Adding items to right-click menu

    You can generate all the data yourself. depending exactly what you need,
    something aloong these lines:
    Private Sub CommandButton1_Click()
    Dim cmdBar As CommandBar
    Dim cmdBarCtrl As CommandBarControl

    For Each cmdBar In CommandBars
    Debug.Print cmdBar.Index, cmdBar.Name
    For Each cmdBarCtrl In cmdBar.Controls
    Debug.Print , cmdBarCtrl.ID, cmdBarCtrl.Caption
    Next
    Next
    End Sub

    NickHK

    "Cumberland" <[email protected]> ¼¶¼g©ó¶l¥ó·s»D:[email protected]...
    >
    > Thanks Simon, much appreciated, but unfortunately they haven't answered
    > my question.
    >
    > You'll notice that the ID numbers I already have, 369 and 370, aren't
    > actually listed in the ID numbers link, so what I really need are
    > absolutely EVERY single ID number possible and what they do. I've had a
    > scan around Microsoft's website, but they aren't there.
    >
    > I could try going through every ID in the macro until I find the right
    > ones, but that could take a LONG time!!!
    >
    >
    > --
    > Cumberland
    > ------------------------------------------------------------------------
    > Cumberland's Profile:
    > http://www.excelforum.com/member.php...o&userid=33445
    > View this thread: http://www.excelforum.com/showthread...hreadid=571718
    >




  9. #9
    Ron de Bruin
    Guest

    Re: Adding items to right-click menu

    See
    http://www.rondebruin.nl/menuid.htm

    Read this part about the ID's
    http://www.rondebruin.nl/menuid.htm#ID


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Cumberland" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi.
    >
    > I have written a short macro to add items to the right-click menu, but
    > am having difficulty finding the right ID numbers. So far, I have
    > managed to add "Paste Values" and "Paste Formatting", as below:
    >
    > Sub AddItems()
    >
    > 'Paste Values
    > Application.CommandBars("cell").Controls.Add Type:=msoControlButton,
    > ID:=370, before:=5
    >
    > 'Paste Formatting
    > Application.CommandBars("cell").Controls.Add Type:=msoControlButton,
    > ID:=369, before:=5
    >
    > End Sub
    >
    > I also want to add the following:
    >
    >
    > - Paste Formulas
    > - Paste Comments
    >
    >
    > But I don't know the relevant ID numbers! Please can anyone tell me
    > what they are?
    >
    > Thanks!
    >
    >
    > --
    > Cumberland
    > ------------------------------------------------------------------------
    > Cumberland's Profile: http://www.excelforum.com/member.php...o&userid=33445
    > View this thread: http://www.excelforum.com/showthread...hreadid=571718
    >




+ 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