none
VSTO add-in: not able to execute ribbon control by MSO ID RRS feed

  • Question

  • Hello,

    I am trying to insert calendar to a new e-mail within Outlook inspector window.

    To do it I use following code:

    Application.ActiveExplorer().CommandBars.ExecuteMso("CalendarInsert");

    And it fails with an error "Value does not fall within the expected range."

    I took MSO ID of the control here: http://www.microsoft.com/en-us/download/details.aspx?id=6627

    Outlook version is 2010.

    What am I doing wrong? Maybe I need to call inspector instead of active explorer, but I haven't found how to do it.



    Tuesday, November 11, 2014 3:54 PM

Answers

All replies

  • Hello Andriy,

    I think you need to use the CommandBars property of the window where the control is located.

    Do you see an insert calendar control on a new mail item window?

    Tuesday, November 11, 2014 4:19 PM
  • Hello Eugene,

    Yes, I can this button:

    Do you know how to access CommandBars within inspector window?

    Wednesday, November 12, 2014 8:09 AM
  • ActiveInspector().CommandBars.ExecuteMso("CalendarInsert");
    Wednesday, November 12, 2014 10:53 AM
  • Thanks, it works. IntelliSense doesn't show CommandBars as one of the properties of Inspector and I didn't guess to write it manually.

    Wednesday, November 12, 2014 3:56 PM