Word : Last document close or application exit?

F

Frenchy

Hello,

I'm developing an add-in with VS2003 (C#). In that Add-in I have to do
specific treatments before closing a document.

I won't explain why, but I have to cancel the closing (in the
Application_DocumentBeforeClose event).

The problem is that I can detect if the user is closing the last
document(if(this.appWord.Documents.Count==1)) , and the close it.

But I can't detect if the user is quitting Word. The event
Application_DocumentBeforeClose will fire but how to know if it is a document
close or the application close?

Thanks.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RnJlbmNoeQ==?=,

Copied from Word's object model Help files

Quit Event
Occurs when the user quits Word.

Private Sub object_Quit()
object An object of type Application declared with events in a class module.
For information about using events with the Application object, see Using Events
with the Application Object.
I'm developing an add-in with VS2003 (C#). In that Add-in I have to do
specific treatments before closing a document.

I won't explain why, but I have to cancel the closing (in the
Application_DocumentBeforeClose event).

The problem is that I can detect if the user is closing the last
document(if(this.appWord.Documents.Count==1)) , and the close it.

But I can't detect if the user is quitting Word. The event
Application_DocumentBeforeClose will fire but how to know if it is a document
close or the application close?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top