Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Customize right-click shortcut menu (2K)

    Is it possible to add another item to the right-click shortcut menu? I would like to add a "save" menu to the right-click menu for a message. The menu item would call a macro. I have added a button to the toolbar that works, but cannot figure out how to add it to the shortcut menu. TIA --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Customize right-click shortcut menu (2K)

    If you want the right-click context menu that applies to "explorer" (folder) views, you can get at it with:

    ActiveExplorer.CommandBars("Context Menu").Controls.Add(etc.)

    But I haven't found the handle to the right-click menu, for, say, attachments.

    After testing:

    I just cannot make this work:

    <pre>Sub AddShortcutItem()
    Dim myMenu As CommandBar
    Set myMenu = ActiveExplorer.CommandBars("Context Menu")
    'Stop 'if you want to inspect its properties
    Dim lngProtection As Long, myButton As CommandBarButton
    lngProtection = myMenu.Protection
    myMenu.Protection = msoBarNoProtection
    'Set myButton = myMenu.Controls.Add(Type:=msoControlButton, Before:=2)
    Set myButton = myMenu.Controls.Add(Type:=msoControlButton)
    'Stop 'If you step through, the control is created, but when you try to
    'use it, it isn't there any more. What the...
    With myButton
    .BeginGroup = True
    .Caption = "&Sniff this message"
    .DescriptionText = "This is a test"
    .Enabled = True
    .OnAction = "MessageSniffer"
    .Priority = 1
    .Style = msoButtonAutomatic
    End With
    Set myButton = Nothing
    myMenu.Protection = lngProtection
    Set myMenu = Nothing
    End Sub</pre>

    There appears to be some kind of special protection for this commandbar. It just does not behave like the others. I'm befuddled.

  3. #3
    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: Customize right-click shortcut menu (2K)

    <P ID="edit" class=small>(Edited by rory on 30-Apr-03 04:18. )</P>Jefferson (and Sammy),
    Unlike the other Office apps, Outlook rebuilds the Context Menu dynamically just before it displays it - hence any customizations you make promptly disappear. I'm sure there's a very good reason for this but what it might be is beyond me at this point... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    I've seen a KB article on this which I'll try and find.

    [Later]
    Yup, it's this one: <!mskb=294221>Microsoft Knowledge Base Article 294221<!/mskb>
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Customize right-click shortcut menu (2K)

    Hmmm, I could have gone to dinner much earlier if I had known that. <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

    Sammy, you might know that you can assign a keystroke (e.g., Alt+X) to your toolbar button by adding a short caption (e.g., eXample). You use the usual syntax (e.g., e&Xample) to create the accelerator key. This probably is the next best thing.

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Customize right-click shortcut menu (2K)

    Thanks, Rory, for the KB reference. I found it hard to believe that something simple in other Office products could not be done in Outlook, but you provided the <img src=/S/sad.gif border=0 alt=sad width=15 height=15> facts. And thanks to Jefferson for experimenting, I was too lazy to try it yesterday, but I'll shape up today! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15> I'll just use a button on the standard toolbar. BTW, do you know of a KB article on how to package the button/macro up for distribution (as an addin?) ? --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  6. #6
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Customize right-click shortcut menu (2K)

    I'll get to work and answer my own question, you cannot create an Outlook application AddIn like you can in Word & Excel, only Com AddIns. Here are some good KB references:
    Questions About Custom Forms and Outlook Solutions, <!mskb=146636>Microsoft Knowledge Base Article 146636<!/mskb>
    Managing and Distributing Outlook VBA Projects, <!mskb=229911>Microsoft Knowledge Base Article 229911<!/mskb>
    How to Create a COM Add-in for Outlook, <!mskb=291163>Microsoft Knowledge Base Article 291163<!/mskb>
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

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