Solved

Catching Events in a Automated MS Word Application

Posted on 2006-07-07
5
342 Views
Last Modified: 2013-11-20
Hello,
         I am trying to automate Word; specifically I would like to open one or more word documents and allow the user to edit them freely. However I need to keep track of certain key events such e.g. save and close. When the user closes one of the documents I need to inform the background program of the result. The program is written in C++, so far I have no problem opening the documents but I can’t find any C++ examples of event handlers and for document close event etc..

Can anyone help?

Thanks,
0
Comment
Question by:winbiz
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 500 total points
ID: 17063846
Following are some articles about MS WORD and event handling..with src samples

Automation and Eventing with Word : http://www.codeguru.com/cpp/com-tech/activex/tutorials/article.php/c2629/

How to catch Word application events by using Visual C++ : http://support.microsoft.com/kb/q183599/

Writing an MS Word addin : http://www.codeproject.com/com/adwordaddin.asp ( refer handling events section )

Hope This Helps.

-MAHESH
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17063861
>>I can’t find any C++ examples of event handlers and for document close event etc..

In above links refer :http://www.codeguru.com/cpp/com-tech/activex/tutorials/article.php/c2629/ <== here close document event is handled..When the Close Document event is received, the number of pages in the document is computed and displayed in the message box ...Refer CWordEventSink::OnDocClose().

Also
In above refer : http://support.microsoft.com/kb/q183599/
Here you may handle 'DocumentBeforeClose' event for your purpose..refer function CAppEventListener::Invoke(..)

-MAHESH
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now