1

Using Visual Studio 2015 to build an addin for Outlook 2013. I have already built this addin for Excel 2013. The addin is to be accessed from the context menu in the body of an e-mail.

The following snippet is typically how I have added the button to the Excel context menu but can't seem to find how to do this for an outlook e-mail:

Dim contextmenu As Office.CommandBar
    Dim DDHButton As Office.CommandBarButton
    contextmenu = Application.CommandBars("cell")

    DDHButton = contextmenu.Controls.Add(Type:=Office.MsoControlType.msoControlButton, Before:=20)

    With DDHButton
        .FaceId = 2308
        .Caption = "Button Name"
        .Tag = "New Button"
        .TooltipText = "etc. etc."
    End With

I have tried to alter this to the following:

contextmenu = Application.ActiveExplorer.CommandBars("ContextMenuMailItem")

And many other variations of this line to no avail.

I have also come across suggestions of creating a ribbon and editing the xml file but have also had absolutely no luck with this either!

Any suggestions?

miroxlav
  • 11,796
  • 5
  • 58
  • 99
Ash
  • 11
  • 2

1 Answers1

2

Your context menu must come from the ribbon XML returned by your addin. See https://msdn.microsoft.com/en-us/library/office/ee692172(v=office.14).aspx

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78