[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2007-10-03
4
Medium Priority
?
1,517 Views
Last Modified: 2013-11-17
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.  
0
Comment
Question by:cdoggett
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:geneus
ID: 20011512
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
 

Author Comment

by:cdoggett
ID: 20018466
Ya, I saw those myself...  Remember I am doing C++.

I added the IApplicationEvents2 interface but the events dont seem to get fired.
0
 
LVL 12

Accepted Solution

by:
geneus earned 1000 total points
ID: 20021014
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
 

Author Comment

by:cdoggett
ID: 20027780
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question