Link to home
Create AccountLog in
Avatar of cdoggett
cdoggett

asked on

How to trap DocumentBeforeClose event in Word 2007 using C++ / ATL

I am writting addin using Visual Studio 2005 C++ and ATL for Word 2007.  How do I get event notifications like    DocumentBeforeClose, DocumentBeforeSave, etc.   I need to do some processing before the document is closed or saved.  
Avatar of geneus
geneus
Flag of United States of America image

Writing application event procedures
http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm

Take Control of Microsoft Word Through Events
http://msdn2.microsoft.com/en-us/library/aa140279(office.10).aspx

Intercepting events like Save and Print
http://word.mvps.org/faqs/macrosvba/interceptsaveprint.htm

Avatar of cdoggett
cdoggett

ASKER

Ya, I saw those myself...  Remember I am doing C++.

I added the IApplicationEvents2 interface but the events dont seem to get fired.
ASKER CERTIFIED SOLUTION
Avatar of geneus
geneus
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Not trying to be a pain, however...  This is all stuff I have seen before.  Please don't send links to 'good stuff' if it doesn't address my exact problem.  I need how to implement a callback for the DocumentBeforeClose event in Visuall Studio 2005 using Word 2007.  This is important, I have it working just fine in Word 2003.  

I tried implementing the ApplicationEvents interface and it created the various Document events, but they are not being executed.