Document Object

Description

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

ActiveWindow property, ActiveWritingStyle property, Application property, AttachedTemplate property, AutoHyphenation property, Background property, Bookmarks property, BuiltInDocumentProperties property, Characters property, CodeName property, CommandBars property, Comments property, Compatibility property, ConsecutiveHyphensLimit property, Container property, Content property, Creator property, CustomDocumentProperties property, DefaultTabStop property, EmbedTrueTypeFonts property, Endnotes property, Envelope property, Fields property, Footnotes property, FormFields property, FormsDesign property, Frames property, FullName property, GrammarChecked property, GrammaticalErrors property, HasMailer property, HasPassword property, HasRoutingSlip property, Hyperlinks property, HyphenateCaps property, HyphenationZone property, Indexes property, InlineShapes property, IsMasterDocument property, IsSubdocument property, Kind property, ListParagraphs property, Lists property, ListTemplates property, Mailer property, MailMerge property, Name property, PageSetup property, Paragraphs property, Parent property, Password property, Path property, PrintFormsData property, PrintFractionalWidths property, PrintPostScriptOverText property, PrintRevisions property, ProtectionType property, ReadabilityStatistics property, ReadOnly property, ReadOnlyRecommended property, Revisions property, Routed property, RoutingSlip property, Saved property, SaveFormat property, SaveFormsData property, SaveSubsetFonts property, Sections property, Sentences property, Shapes property, ShowGrammaticalErrors property, ShowRevisions property, ShowSpellingErrors property, ShowSummary property, SpellingChecked property, SpellingErrors property, StoryRanges property, Styles property, Subdocuments property, SummaryLength property, SummaryViewMode property, Tables property, TablesOfAuthorities property, TablesOfAuthoritiesCategories property, TablesOfContents property, TablesOfFigures property, TrackRevisions property, Type property, UpdateStylesOnOpen property, UserControl property, Variables property, VBProject property, Versions property, Windows property, Words property, WritePassword property, WriteReserved property.

Methods

AcceptAllRevisions method, Activate method, AddToFavorites method, AutoFormat method, AutoSummarize method, CheckGrammar method, CheckSpelling method, Close method, ClosePrintPreview method, Compare method, ComputeStatistics method, ConvertNumbersToText method,

CopyStylesFromTemplate method, CountNumberedItems method, CreateLetterContent method, DataForm method, EditionOptions method, FitToPages method, FollowHyperlink method, ForwardMailer method, GetCrossReferenceItems method, GetLetterContent method, GoTo method, MakeCompatibilityDefault method, ManualHyphenation method, Merge method, Post method, PresentIt method, PrintOut method (Application, Document, and Window Objects), PrintPreview method, Protect method, Range method, Redo method, RejectAllRevisions method, Reload method, RemoveNumbers method, Repaginate method, Reply method, ReplyAll method, Route method, RunAutoMacro method, RunLetterWizard method, Save method, SaveAs method, Select method, SendFax method, SendMail method, SendMailer method, SetLetterContent method, ToggleFormsDesign method, Undo method, UndoClear method, UnProtect method, UpdateStyles method, UpdateSummaryProperties method, ViewCode method, ViewPropertyBrowser method.

Events

Close event, New event, Open event.

See Also

Template object.