Document object (Word)
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.
Remarks
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
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
- BuildingBlockInsert
- Close
- ContentControlAfterAdd
- ContentControlBeforeContentUpdate
- ContentControlBeforeDelete
- ContentControlBeforeStoreUpdate
- ContentControlOnEnter
- ContentControlOnExit
- New
- Open
- Sync
- XMLAfterInsert
- XMLBeforeDelete
Methods
- AcceptAllRevisions
- AcceptAllRevisionsShown
- Activate
- AddToFavorites
- ApplyDocumentTheme
- ApplyQuickStyleSet2
- ApplyTheme
- AutoFormat
- CanCheckin
- CheckConsistency
- CheckGrammar
- CheckIn
- CheckInWithVersion
- CheckSpelling
- Close
- ClosePrintPreview
- Compare
- ComputeStatistics
- Convert
- ConvertAutoHyphens
- ConvertNumbersToText
- ConvertVietDoc
- CopyStylesFromTemplate
- CountNumberedItems
- CreateLetterContent
- DataForm
- DeleteAllComments
- DeleteAllCommentsShown
- DeleteAllEditableRanges
- DeleteAllInkAnnotations
- DetectLanguage
- DowngradeDocument
- EndReview
- ExportAsFixedFormat
- ExportAsFixedFormat2
- FitToPages
- FollowHyperlink
- FreezeLayout
- GetCrossReferenceItems
- GetLetterContent
- GetWorkflowTasks
- GetWorkflowTemplates
- GoTo
- LockServerFile
- MakeCompatibilityDefault
- ManualHyphenation
- Merge
- Post
- PresentIt
- PrintOut
- PrintPreview
- Protect
- Range
- Redo
- RejectAllRevisions
- RejectAllRevisionsShown
- Reload
- ReloadAs
- RemoveDocumentInformation
- RemoveLockedStyles
- RemoveNumbers
- RemoveTheme
- Repaginate
- ReplyWithChanges
- ResetFormFields
- ReturnToLastReadPosition
- RunAutoMacro
- RunLetterWizard
- Save
- SaveAs2
- SaveAsQuickStyleSet
- Select
- SelectAllEditableRanges
- SelectContentControlsByTag
- SelectContentControlsByTitle
- SelectLinkedControls
- SelectNodes
- SelectSingleNode
- SelectUnlinkedControls
- SendFax
- SendFaxOverInternet
- SendForReview
- SendMail
- SetCompatibilityMode
- SetDefaultTableStyle
- SetLetterContent
- SetPasswordEncryptionOptions
- ToggleFormsDesign
- TransformDocument
- Undo
- UndoClear
- Unprotect
- UpdateStyles
- ViewCode
- ViewPropertyBrowser
- WebPagePreview
Properties
- 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
- 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
- SensitivityLabel
- 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
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기