Document Object (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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.

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

Events

Methods

Properties

Name

ActiveTheme

ActiveThemeDisplayName

ActiveWindow

ActiveWritingStyle

Application

AttachedTemplate

AutoFormatOverride

AutoHyphenation

Background

Bibliography

Bookmarks

Broadcast

BuiltInDocumentProperties

Characters

ChartDataPointTrack

ClickAndTypeParagraphStyle

CoAuthoring

CodeName

CommandBars

Comments

Compatibility

CompatibilityMode

ConsecutiveHyphensLimit

Container

Content

ContentControls

ContentTypeProperties

Creator

CurrentRsid

CustomDocumentProperties

CustomXMLParts

DefaultTableStyle

DefaultTabStop

DefaultTargetFrame

DisableFeatures

DisableFeaturesIntroducedAfter

DocumentInspectors

DocumentLibraryVersions

DocumentTheme

DoNotEmbedSystemFonts

Email

EmbedLinguisticData

EmbedTrueTypeFonts

EncryptionProvider

Endnotes

EnforceStyle

Envelope

FarEastLineBreakLanguage

FarEastLineBreakLevel

Fields

Final

Footnotes

FormattingShowClear

FormattingShowFilter

FormattingShowFont

FormattingShowNextLevel

FormattingShowNumbering

FormattingShowParagraph

FormattingShowUserStyleName

FormFields

FormsDesign

Frames

Frameset

FullName

GrammarChecked

GrammaticalErrors

GridDistanceHorizontal

GridDistanceVertical

GridOriginFromMargin

GridOriginHorizontal

GridOriginVertical

GridSpaceBetweenHorizontalLines

GridSpaceBetweenVerticalLines

HasPassword

HasVBProject

HTMLDivisions

Hyperlinks

HyphenateCaps

HyphenationZone

Indexes

InlineShapes

IsInAutosave

IsMasterDocument

IsSubdocument

JustificationMode

KerningByAlgorithm

Kind

LanguageDetected

ListParagraphs

Lists

ListTemplates

LockQuickStyleSet

LockTheme

MailEnvelope

MailMerge

Name

NoLineBreakAfter

NoLineBreakBefore

OMathBreakBin

OMathBreakSub

OMathFontName

OMathIntSubSupLim

OMathJc

OMathLeftMargin

OMathNarySupSubLim

OMathRightMargin

OMaths

OMathSmallFrac

OMathWrap

OpenEncoding

OptimizeForWord97

OriginalDocumentTitle

PageSetup

Paragraphs

Parent

Password

PasswordEncryptionAlgorithm

PasswordEncryptionFileProperties

PasswordEncryptionKeyLength

PasswordEncryptionProvider

Path

Permission

PrintFormsData

PrintPostScriptOverText

PrintRevisions

ProtectionType

ReadabilityStatistics

ReadingLayoutSizeX

ReadingLayoutSizeY

ReadingModeLayoutFrozen

ReadOnly

ReadOnlyRecommended

RemoveDateAndTime

RemovePersonalInformation

Research

RevisedDocumentTitle

Revisions

Saved

SaveEncoding

SaveFormat

SaveFormsData

SaveSubsetFonts

Scripts

Sections

Sentences

ServerPolicy

Shapes

ShowGrammaticalErrors

ShowSpellingErrors

Signatures

SmartDocument

SnapToGrid

SnapToShapes

SpellingChecked

SpellingErrors

StoryRanges

Styles

StyleSheets

StyleSortMethod

Subdocuments

Sync

Tables

TablesOfAuthorities

TablesOfAuthoritiesCategories

TablesOfContents

TablesOfFigures

TextEncoding

TextLineEnding

TrackFormatting

TrackMoves

TrackRevisions

Type

UpdateStylesOnOpen

UseMathDefaults

UserControl

Variables

VBASigned

VBProject

WebOptions

Windows

WordOpenXML

Words

WritePassword

WriteReserved

XMLSaveThroughXSLT

XMLSchemaReferences

XMLShowAdvancedErrors

XMLUseXSLTWhenSaving

Show: