Link to home
Start Free TrialLog in
Avatar of winbiz
winbiz

asked on

Catching Events in a Automated MS Word Application

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,
ASKER CERTIFIED SOLUTION
Avatar of mahesh1402
mahesh1402
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>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