HOWTO: Use Events to Determine When Word QuitsLast reviewed: September 29, 1997Article ID: Q172055 |
The information in this article applies to:
SUMMARYVisual Basic 5.0 introduces a keyword, WithEvents, that enables your Visual Basic application to respond to the events triggered by an ActiveX server. This article illustrates how you can use WithEvents in your Visual Basic application to trap the Quit event of the Microsoft Word Application object.
MORE INFORMATIONTo trap the events of an ActiveX server, you must first declare a variable that will mirror the actual object. In this example, the ActiveX object is the Word Application. The declaration appears as follows:
Dim WithEvents objWord As Word.ApplicationOnce the Word.Application object is declared in this manner, you can respond to the events that it triggers. For example, to respond to the Quit event of objWord that references Word.Application, you can create a sub procedure named objWord_Quit.
Step-by-Step ExampleNOTE: Microsoft Word 97 is the only Microsoft Office application that exposes a Quit event.
Keywords : vb5all vb5howto vbwin GnrlVb kbprg Technology : kbvba Version : WINDOWS:5.0 97 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |