DocumentClosing Event

Subscribe to the DocumentClosing event to be notified when Revit is just about to close a document.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2010


public event EventHandler<DocumentClosingEventArgs> DocumentClosing
Visual Basic
Public Event DocumentClosing As EventHandler(Of DocumentClosingEventArgs)
Visual C++
 event EventHandler<DocumentClosingEventArgs^>^ DocumentClosing {
	void add (EventHandler<DocumentClosingEventArgs^>^ value);
	void remove (EventHandler<DocumentClosingEventArgs^>^ value);


This event is raised when Revit is just about to close a document.

This event is cancellable, except when it is raised as part of application closing. Check the 'Cancellable' property of event's argument to see whether it is cancellable or not. When it is cancellable, call the 'Cancel()' method of event's argument to True to cancel it. Your application is responsible for providing feedback to the user about the reason for the cancellation.

The document may not be modified during this event.

The following API functions are not available for the current document during this event:

Exception InvalidOperationException will be thrown if any of the above methods is called during this event.

Another Autodesk::Revit::ApplicationServices::Application::DocumentClosed event will be raised immediately after document is closed.

See Also