Returns an instance of the Document object corresponding to the first document in the document collection of the application.
Applies to: Application object
[[Set] docRet =] object.FirstDoc () |
The FirstDoc method syntax has these parts:
Part | Description |
object | Required. An expression, that returns an instance of the Application object. |
docRet | Optional. A Document type variable. |
If there are no open documents in the application, the FirstDoc method returns Nothing. To get the next documents in the document collection, use the NextDoc method.
This example contains an application-level script. The script saves and closes all open documents, using the FirstDoc method to go through documents.
Dim curDoc As Document Set curDoc = thisApp.FirstDoc() ' Get the first document While curDoc <> Nothing curDoc.Save() ' Save document in the current folder thisApp.CloseDoc( curDoc ) ' Close document curDoc = thisApp.FirstDoc() ' Get next document Wend |
See Also |
CloseDoc method, CreateNewDoc method, Doc method, DocByName method, DocsNum method, NextDoc method, OpenDoc method, Document object |