Solved

Catching Events in a Automated MS Word Application

Posted on 2006-07-07
5
346 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
unable to delete all specified values regedit 38 267
Detect CR LF to each line 12 152
move a line in eclipse 3 80
sumHeights  challenge 17 65
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
A short film showing how OnPage and Connectwise integration works.

939 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

4 Experts available now in Live!

Get 1:1 Help Now