Programmatically Using Track Changes Comments in Outlook 2013 Add-in RRS feed

  • Question

  • I've developed a VSTO Outlook add-in that uses the track changes comment functionality of Word to highlight certain keywords in emails. This works great in Outlook 2010, but not in Outlook 2013. When I attempt to do this, I get the following exception:

    System.Runtime.InteropServices.COMException (0x800A11FD): This command is not available.
        at Microsoft.Office.Interop.Word.Comments.Add(Range Range, Object& Text)

    This seems to imply that the function is not available, even when using Word as the Outlook message editor. I checked this by verifying the registry keyHKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Options\Mail valueEditorPreference is set to 0x00030001 (196609), which should set Word as the editor.

    I know that Microsoft changed how comments work in Office 2013, but the functionality is fundamentally the same from the user perspective.

    Does anyone have insight into why this could be happening, or more importantly a fix or workaround?

    My code is below:

    var document = Inspector.WordEditor as Word.Document;
    foreach (Word.Paragraph paragraph in document.Paragraphs) {
        range = paragraph.Range;
        range.MoveStart(Word.WdUnits.wdCharacter, highlight.Start);
        range.MoveEnd(Word.WdUnits.wdCharacter, highlight.Length);
        var comment = range.Comments.Add(range, "Look at this word!");
    Friday, May 31, 2013 10:34 PM

All replies

  • Hi Jeff,

    Thank you for posting in the MSDN Forum.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best regards,

    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 3, 2013 12:24 PM
  • I will test this locally. Will keep you posted on updates.

    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Tuesday, June 11, 2013 6:18 PM
  • With the Word 2013 Object Model, i tried adding the comments at the specific range - it works for me - i can add the changes; so the command exists. In which scenario, do you repro the issue - at the start of the document, middle or end of the document or at any selection?

    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Wednesday, June 19, 2013 2:50 AM
  • Any updates for me?

    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Thursday, June 20, 2013 7:40 PM
  • Hi DeVa,

    I much appreciate you taking the time to look into the issue. Are you seeing this with the Word component of Outlook 2013, or in native Word 2013 itself?

    I haven't had a chance to see if just Word works, but I'm seeing the error occur in the Word subset of Outlook 2013. The error occurs at any position in the document.

    Can you post the code you're using?


    Wednesday, June 26, 2013 4:11 PM