none
Office word - If there are two word documents open how do you determine the current document in each window. RRS feed

  • Question

  • If there are two word documents open how do you determine the current document in each window.

    So I have an addin that is producing a backstage ui.  This ui is focused on the current loaded document.  I can access the active document via the Application.ActiveDocument but need a window centric document object.

    Wednesday, November 13, 2013 5:57 PM

Answers

  • Hello,  Found what I was looking for.  

    There is a context property that is passed into the various gettext, getlabel callback functions.  In that window context object is the relative document object.

    In my case I needed to cast the context to the appropriate office.word.window object and then access the window.document object.

    • Marked as answer by 123123123e Thursday, November 14, 2013 4:56 PM
    Thursday, November 14, 2013 4:56 PM

All replies

  • Hi,

    According to your description, you want to access the active window instead of active document.

    You could use the Application.ActiveWindow Property. It returns a Window object that represents the active window (the window with the focus). If there are no windows open, an error occurs.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, November 14, 2013 12:08 PM
    Moderator
  • Hello,  Found what I was looking for.  

    There is a context property that is passed into the various gettext, getlabel callback functions.  In that window context object is the relative document object.

    In my case I needed to cast the context to the appropriate office.word.window object and then access the window.document object.

    • Marked as answer by 123123123e Thursday, November 14, 2013 4:56 PM
    Thursday, November 14, 2013 4:56 PM