Share via


CloseAll Method

Home Page (Objects)OverviewFAQReference

Applies to: Documents object, Windows object

Closes all windows or documents.

Syntax

object**.CloseAll** [SaveChanges]

Parameters

object

An expression that evaluates to a Documents object or a Windows object.

SaveChanges

(Optional) An enum of type DsSaveChanges that indicates whether to save changes to one or more documents before closing them. Following are the possible values, which have the Long type:

  • dsSaveChangesYes   Saves the changes (the default).

  • dsSaveChangesNo   Does not save the changes.

  • dsSaveChangesPrompt   Prompts the user to save changes. If the user chooses not to save the changes, CloseAll returns the enum dsSaveStatus with the value dsSaveCanceled; otherwise CloseAll returns dsSaveSucceeded.

Return Values

The CloseAll method returns the enum dsSaveStatus, which has one of the following values:

  • dsSaveCanceled   Indicates that the user chose not to save changes to the document.

  • dsSaveSucceeded   Indicates that the user saved changes to the document.

Example

The following example saves the changes to all open documents and then closes those documents:

Documents.CloseAll

See Also   Open method.