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.  
cdoggettAsked:
Who is Participating?
 
geneusCommented:
Maybe these resources will help you better.

HOW TO: Handle Word Events by Using Visual C++ .NET and MFC
http://support.microsoft.com/kb/309294/zh-cn

Office Automation Using Visual C++
http://support.microsoft.com/kb/196776

Microsoft Office Development with Visual Studio
http://msdn2.microsoft.com/en-us/library/aa188489(office.10).aspx

Automation part 2
http://www.tenouk.com/download/pdf/visualcplusmfc24a.pdf

Supplementary Note: Automation and Remote Automation
http://www.tenouk.com/visualcplusmfc/mfcsupp/automation.html
0
 
geneusCommented:
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

0
 
cdoggettAuthor Commented:
Ya, I saw those myself...  Remember I am doing C++.

I added the IApplicationEvents2 interface but the events dont seem to get fired.
0
 
cdoggettAuthor Commented:
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.



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.