Detect when MS Word Has Quit After Starting an Instance of Word Application Object

Category:
Office/VBA
Type:
Snippets
Difficulty:
Beginning
Author:
Intelligent Solutions Inc.

Version Compatibility:

More information:
A commonly asked question is how does one detect when a user has ended Word after an instance of the Word Application object is instantiated. The answer is to declare the Word Application object with the WithEvents keyword, as illustrated by this code. A reference to the Word Object Library is required.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: