none
Ctrl + F4 don't trigger OnFileClose RRS feed

  • Question

  • Hi,

    I am working on a Word Add - In and I need to clean up resources (custom task pane etc.) when a user closes a word document. I have added code for clean up on event OnFileClose. But OnFileClose is not triggered on Ctrl + F4. What event does Ctrl + F4 trigger apart from Application_DocumentBeforeClose where I can do the clean up?

    Regards,

    Himani

    Wednesday, March 23, 2011 4:43 PM

Answers

  • Hi himania,

    Thanks for posting in the MSDN Forum.

    Do you mean Alt + F4 close the Word application in you post?

    I would recommend you use quit event to handle this. Please look the snippet, and try it.

    ((Word.ApplicationEvents3_Event)Application).Quit += new Word.ApplicationEvents3_QuitEventHandler(ThisAddIn_Quit);
    

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 25, 2011 7:31 AM
    Moderator

All replies

  • Hi himania,

    Thanks for posting in the MSDN Forum.

    Do you mean Alt + F4 close the Word application in you post?

    I would recommend you use quit event to handle this. Please look the snippet, and try it.

    ((Word.ApplicationEvents3_Event)Application).Quit += new Word.ApplicationEvents3_QuitEventHandler(ThisAddIn_Quit);
    

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 25, 2011 7:31 AM
    Moderator
  • Thanks Tony.
    Monday, March 28, 2011 6:31 AM