Document Object
Multiple objects Document Multiple objects |
Represents a document. The Document object is a member of the Documents collection. The Documents collection contains all the Document objects that are currently open in Word.
Using the Document Object
Use Documents(index), where index is the document name or index number to return a single Document object. The following example closes the document named "Report.doc" without saving changes.
Documents("Report.doc").Close SaveChanges:=wdDoNotSaveChanges
The index number represents the position of the document in the Documents collection. The following example activates the first document in the Documents collection.
Documents(1).Activate
Using ActiveDocument
You can use the ActiveDocument property to refer to the document with the focus. The following example uses the Activate method to activate the document named "Document 1." The example also sets the page orientation to landscape mode and then prints the document.
Documents("Document1").Activate
ActiveDocument.PageSetup.Orientation = wdOrientLandscape
ActiveDocument.PrintOut
Properties | ActiveTheme Property | ActiveThemeDisplayName Property | ActiveWindow Property | ActiveWritingStyle Property | Application Property | AttachedTemplate Property | AutoFormatOverride Property | AutoHyphenation Property | Background Property | Bookmarks Property | BuiltInDocumentProperties Property | Characters Property | ChildNodeSuggestions Property | ClickAndTypeParagraphStyle Property | CodeName Property | CommandBars Property | Comments Property | Compatibility Property | ConsecutiveHyphensLimit Property | Container Property | Content Property | Creator Property | CustomDocumentProperties Property | DefaultTableStyle Property | DefaultTabStop Property | DefaultTargetFrame Property | DisableFeatures Property | DisableFeaturesIntroducedAfter Property | DocumentLibraryVersions Property | DoNotEmbedSystemFonts Property | Email Property | EmbedLinguisticData Property | EmbedSmartTags Property | EmbedTrueTypeFonts Property | Endnotes Property | EnforceStyle Property | Envelope Property | FarEastLineBreakLanguage Property | FarEastLineBreakLevel Property | Fields Property | Footnotes Property | FormattingShowClear Property | FormattingShowFilter Property | FormattingShowFont Property | FormattingShowNumbering Property | FormattingShowParagraph Property | FormFields Property | FormsDesign Property | Frames Property | Frameset Property | FullName Property | Getting Help on Macintosh Keywords | GrammarChecked Property | GrammaticalErrors Property | GridDistanceHorizontal Property | GridDistanceVertical Property | GridOriginFromMargin Property | GridOriginHorizontal Property | GridOriginVertical Property | GridSpaceBetweenHorizontalLines Property | GridSpaceBetweenVerticalLines Property | HasPassword Property | HasRoutingSlip Property | HTMLDivisions Property | HTMLProject Property | Hyperlinks Property | HyphenateCaps Property | HyphenationZone Property | Indexes Property | InlineShapes Property | IsMasterDocument Property | IsSubdocument Property | JustificationMode Property | KerningByAlgorithm Property | Kind Property | LanguageDetected Property | ListParagraphs Property | Lists Property | ListTemplates Property | MailEnvelope Property | MailMerge Property | Name Property | NoLineBreakAfter Property | NoLineBreakBefore Property | OpenEncoding Property | OptimizeForWord97 Property | PageSetup Property | Paragraphs Property | Parent Property | Password Property | PasswordEncryptionAlgorithm Property | PasswordEncryptionFileProperties Property | PasswordEncryptionKeyLength Property | PasswordEncryptionProvider Property | Path Property | Permission Property | PrintFormsData Property | PrintFractionalWidths Property | PrintPostScriptOverText Property | PrintRevisions Property | ProtectionType Property | ReadabilityStatistics Property | ReadingLayoutFrozen Property | ReadingLayoutSizeX Property | ReadingLayoutSizeY Property | ReadOnly Property | ReadOnlyRecommended Property | RemoveDateAndTime Property | RemovePersonalInformation Property | Revisions Property | Routed Property | RoutingSlip Property | Saved Property | SaveEncoding Property | SaveFormat Property | SaveFormsData Property | SaveSubsetFonts Property | Scripts Property | Sections Property | Sentences Property | Shapes Property | SharedWorkspace Property | ShowGrammaticalErrors Property | ShowRevisions Property | ShowSpellingErrors Property | ShowSummary Property | Signatures Property | SmartDocument Property | SmartTags Property | SmartTagsAsXMLProps Property | SnapToGrid Property | SnapToShapes Property | SpellingChecked Property | SpellingErrors Property | StoryRanges Property | Styles Property | StyleSheets Property | Subdocuments Property | SummaryLength Property | SummaryViewMode Property | Sync Property | Tables Property | TablesOfAuthorities Property | TablesOfAuthoritiesCategories Property | TablesOfContents Property | TablesOfFigures Property | TextEncoding Property | TextLineEnding Property | TrackRevisions Property | Type Property | UpdateStylesOnOpen Property | UserControl Property | Variables Property | VBASigned Property | VBProject Property | Versions Property | WebOptions Property | Windows Property | Words Property | WritePassword Property | WriteReserved Property | XMLHideNamespaces Property | XMLNodes Property | XMLSaveDataOnly Property | XMLSaveThroughXSLT Property | XMLSchemaReferences Property | XMLSchemaViolations Property | XMLShowAdvancedErrors Property | XMLUseXSLTWhenSaving Property
Methods | AcceptAllRevisions Method | AcceptAllRevisionsShown Method | Activate Method | AddToFavorites Method | ApplyTheme Method | AutoFormat Method | AutoSummarize Method | CanCheckin Method | CheckConsistency Method | CheckGrammar Method | CheckIn Method | CheckNewSmartTags Method | CheckSpelling Method | Close Method | ClosePrintPreview Method | Compare Method | ComputeStatistics Method | ConvertNumbersToText Method | ConvertVietDoc Method | CopyStylesFromTemplate Method | CountNumberedItems Method | CreateLetterContent Method | DataForm Method | DeleteAllComments Method | DeleteAllCommentsShown Method | DeleteAllEditableRanges Method | DeleteAllInkAnnotations Method | DetectLanguage Method | EndReview Method | FitToPages Method | FollowHyperlink Method | GetCrossReferenceItems Method | GetLetterContent Method | Getting Help on Macintosh Keywords | Getting Help on Macintosh Keywords | Getting Help on Macintosh Keywords | GoTo Method | MakeCompatibilityDefault Method | ManualHyphenation Method | Merge Method | Post Method | PresentIt Method | PrintOut Method | PrintPreview Method | Protect Method | Range Method | RecheckSmartTags Method | Redo Method | RejectAllRevisions Method | RejectAllRevisionsShown Method | Reload Method | ReloadAs Method | RemoveLockedStyles Method | RemoveNumbers Method | RemoveSmartTags Method | RemoveTheme Method | Repaginate Method | Reply Method | ReplyAll Method | ReplyWithChanges Method | ResetFormFields Method | Route Method | RunAutoMacro Method | RunLetterWizard Method | Save Method | SaveAs Method | Select Method | SelectAllEditableRanges Method | SelectNodes Method | SelectSingleNode Method | SendFax Method | SendFaxOverInternet Method | SendForReview Method | SendMail Method | SetDefaultTableStyle Method | SetLetterContent Method | SetPasswordEncryptionOptions Method | ToggleFormsDesign Method | TransformDocument Method | Undo Method | UndoClear Method | UnProtect Method | UpdateStyles Method | UpdateSummaryProperties Method | ViewCode Method | ViewPropertyBrowser Method | WebPagePreview Method
Events | Close Event | New Event | Open Event | Sync Event | XMLAfterInsert Event | XMLBeforeDelete Event
Parent Objects | Application Object | Global Object | Pane Object | Range Object | Selection Object | Window Object | XMLNode Object
Child Objects | Bookmarks Object | Characters Object | Comments Object | Email Object | Endnotes Object | Envelope Object | Fields Object | Footnotes Object | FormFields Object | Frames Object | Frameset Object | HTMLDivisions Object | Hyperlinks Object | Indexes Object | InlineShapes Object | ListParagraphs Object | Lists Object | ListTemplates Object | Mailer Object | MailMerge Object | PageSetup Object | Paragraphs Object | ProofreadingErrors Object | Range Object | ReadabilityStatistics Object | Revisions Object | RoutingSlip Object | Sections Object | Sentences Object | Shape Object | Shapes Object | SmartTags Object | StoryRanges Object | Styles Object | StyleSheets Object | Subdocuments Object | Tables Object | TablesOfAuthorities Object | TablesOfAuthoritiesCategories Object | TablesOfContents Object | TablesOfFigures Object | Variables Object | Versions Object | WebOptions Object | Window Object | Windows Object | Words Object | XMLChildNodeSuggestions Object | XMLNodes Object | XMLSchemaReferences Object
See Also | ActiveDocument Property | Template Object | Working with Document Objects