none
Why WindowDeactivate event is called when Selection.Range.Comments.Add(range, " ") action is performed RRS feed

  • Question

  • If I call Selection.Range.Comments.Add(range, " ") using Microsoft.Office.Interop.Wor, the event Application.WindowDeactivate is triggered, but no Application.WindowActivate event, even if document window has focus after inserting comment.

    I use code like this:

    Application.WindowActivate += ApplicationOnWindowActivate;
    Application.WindowDeactivate += ApplicationOnWindowDeactivate;

    Later in the callback of Ribbon's button:

    Selection selection = Application.Selection;

    Comment comment = selection.Range.Comments.Add(range, "comment");

    After this line ApplicationOnWindowDeactivate event is triggered but not ApplicationOnWindowActivate.

    Is it a bug?


    Boris Lehečka (Word, Access, VBA, XML, C#, SQL)

    Thursday, August 17, 2017 10:14 PM

All replies

  • Hi Boris Lehečka,

    I could reproduce your issue. It is really strange and I suggest you make a feedback via the Feedback option in backstage view in Word.

    Best Regards,

    Terry

    Friday, August 18, 2017 7:04 AM