Closes the document and all its windows.
Applies to: Application object
[[Let] booleanRet =] object.CloseDoc ( documentObj ) |
The CloseDoc method syntax has these parts:
Part | Description |
object | Required. An expression that returns an instance of the Application object. |
documentObj | Required. An expression that returns an instance of the Document object (the document to be closed). |
booleanRet | Optional. A Boolean type variable. |
If the document was closed successfully the CloseDoc method returns True, otherwise it returns False. The document can't be closed if a Basic script of the document or one of its shapes or pages is running.
When using the ClodeDoc method remember that it closes the closeDocument document without saving unsaved changes.
This example contains an application-level script. The script closes all the documents open in the application without saving changes.
Dim curDoc as Document ' Declare the curDoc variable. For i=1 To thisapp.DocsNum() ' Loop through all open documents curDoc = thisApp.Doc(1) ' Get the document with index 1 thisapp.CloseDoc( curDoc ) 'Close the document Next i |
See Also |
CreateNewDoc method, Doc method, DocByName method, DocsNum method, FirstDoc method, NextDoc method, OpenDoc method, Document object |