Event that is fired whenever a document is closed.
Private Sub objAppEvents_OnCloseDocument(ByVal DocumentObject As Document, ByVal FullFileName As String, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
If BeforeOrAfter = kBefore Then
Debug.Print "OnCloseDocument event vetoed"
HandlingCode = kEventCanceled
End If
End Sub
Name | Type | Description |
DocumentObject | Document | The Document object that is being closed. The document being closed is provided for both the kBefore and kAfter cases. This is because the Document is still available after it's closed, although in a limited sense, until it is terminated. One of the useful things you can do with a document in this state is to compare it's identity with a reference previously saved (usually during kBefore). For example:
Private m_oClosingDoc As Object |
FullDocumentName | String | Output string that specifies the fully qualified name of the document being closed. This is supplied both before and after. |
BeforeOrAfter | EventTimingEnum | Input indicating if the event is being fired before (kBefore) or after (kAfter) the document is closed. Notification is sent before and after the document is closed. In the case where this event is canceled the value of this argument will be kAbort. |
Context | NameValueMap | Input object that can be used to determine the context of why the event fired. This event provides additional information through the Context argument as described below: Name = "HealthStatusEnum", Value = The health status of the document. If this value is anything other than kUpToDateHealth you know the Document object returned is not in a state where you can use most of its methods or properties. |
HandlingCode | HandlingCodeEnum | This event supports the ability to cancel the close. By setting this argument to kEventCanceled when the BeforeOrAfter argument is kBefore Inventor will abort the close. When the close is cancelled, this event is fired again but the BeforeOrAfter argument will have a value of kAbort. |