Several events are found on VSTO objects that are not found when using the Word PIA alone. Table 7-1 lists these events. Almost all of these are events from the Word PIA that are re-raised on different objects. For example, in the Word PIA, there is no BeforeSave event on the Document. However, there is a DocumentBeforeSave event on the Application object that passes as a parameter the Document that is about to be saved. VSTO adds a BeforeSave event to the Document object for Word. The Document object's BeforeSave event is raised whenever the Application object's DocumentBeforeSave event is raised with the given Document object as a parameter.
Table 7-1. Events That Are Added in VSTO
Events | Re-Raised From |
---|
Document Object |
---|
ActivateEvent | Application.WindowActivate |
BeforeClose | Application.DocumentBeforeClose |
BeforeDoubleClick | Application.WindowBeforeDoubleClick |
BeforePrint | Application.DocumentBeforePrint |
BeforeRightClick | Application.WindowBeforeRightClick |
BeforeSave | Application.DocumentBeforeSave |
CloseEvent | Renamed Document.Close event to avoid collisions |
Deactivate | Application.WindowDeactivate |
MailMergeAfterMerge | Application.MailMergeAfterMerge |
MailMergeAfterRecordMerge | Application.MailMergeAfterRecordMerge |
MailMergeBeforeMerge | Application.MailMergeBeforeMerge |
MailMergeBeforeRecordMerge | Application.MailMergeBeforeRecordMerge |
MailMergeDataSourceLoad | Application.MailMergeDataSourceLoad |
MailMergeWizardSendToCustom | Application.MailMergeWizardSendToCustom |
MailMergeWizardStateChange | Application.MailMergeWizardStateChange |
SelectionChange | Application.WindowSelectionChange |
Startup | New event raised by VSTO |
Shutdown | New event raised by VSTO |
SyncEvent | Renamed Document.Sync event to avoid collisions |
WindowSize | Application.WindowSize |
Another case where VSTO changes events is in the naming of the Close event and the Sync event on the Document object. Both of these event names conflict with method names on Document. To avoid this conflict, VSTO renames these events to CloseEvent and SyncEvent.
VSTO adds events to some objects that have no events at all in the Word PIA. These objects include Bookmark, XMLNode, and XMLNodes. Table 7-1 lists the events added to these objects. You can determine what a particular event does by reading the documentation for the event from which it is re-raised.