Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Catching Events in a Automated MS Word Application

Posted on 2006-07-07
5
Medium Priority
?
371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

722 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