Document Methods (Word)

GitHub-Mark-64px

Contribute to this content

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

Name

Description

AcceptAllRevisions

Accepts all tracked changes in the specified document.

AcceptAllRevisionsShown

Accepts all revisions in the specified document that are displayed on the screen.

Activate

Activates the specified document so that it becomes the active document.

AddToFavorites

Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.

ApplyDocumentTheme

ApplyQuickStyleSet2

Applies the specified Quick Style set to the document.

ApplyTheme

Applies a theme to an open document.

AutoFormat

Automatically formats a document.

CanCheckin

True if Microsoft Word can check in a specified document to a server. Read/write Boolean.

CheckConsistency

Searches all text in a Japanese language document and displays instances where character usage is inconsistent for the same words.

CheckGrammar

Begins a spelling and grammar check for the specified document or range.

CheckIn

Returns a document from a local computer to a server, and sets the local document to read-only so that it cannot be edited locally.

CheckInWithVersion

Saves a document to a server from a local computer, and sets the local document to read-only so that it cannot be edited locally.

CheckSpelling

Begins a spelling check for the specified document or range. .

Close

Closes the specified document.

ClosePrintPreview

Switches the specified document from print preview to the previous view.

Compare

Displays revision marks that indicate where the specified document differs from another document.

ComputeStatistics

Returns a statistic based on the contents of the specified document. Long.

Convert

Converts file to the newest file format and enables all new features.

ConvertAutoHyphens

Converts hyphens created by automatic hyphenation to manual hyphens.

ConvertNumbersToText

Changes the list numbers and LISTNUM fields in the specified Document to text. .

ConvertVietDoc

Reconverts a Vietnamese document to Unicode using a code page other than the default.

CopyStylesFromTemplate

Copies styles from the specified template to a document.

CountNumberedItems

Returns the number of bulleted or numbered items and LISTNUM fields in the specified Document object.

CreateLetterContent

Creates and returns a LetterContent object based on the specified letter elements. LetterContent object.

DataForm

Displays the Data Form dialog box, in which you can add, delete, or modify records.

DeleteAllComments

Deletes all comments from the Comments collection in a document.

DeleteAllCommentsShown

Deletes all revisions in a specified document that are displayed on the screen.

DeleteAllEditableRanges

Deletes permissions in all ranges for which the specified user or group of users has permission to modify.

DeleteAllInkAnnotations

Deletes all handwritten ink annotations in a document.

DetectLanguage

Analyzes the specified text to determine the language that it is written in.

DowngradeDocument

Downgrades a document to the Word 97-2003 document format so that it can be edited in a previous version of Microsoft Word. .

EndReview

Terminates a review of a file that has been sent for review using the SendForReview method or that has been automatically placed in a review cycle by sending a document to another user in an e-mail message.

ExportAsFixedFormat

Saves a document as PDF or XPS format.

FitToPages

Decreases the font size of text just enough so that the document will fit on one fewer pages.

FollowHyperlink

Displays a cached document, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

FreezeLayout

In Web view, fixes the layout of the document as it currently appears so that line breaks remain fixed and ink annotations do not move when you resize the window.

GetCrossReferenceItems

Returns an array of items that can be cross-referenced based on the specified cross-reference type.

GetLetterContent

Retrieves letter elements from the specified document and returns a LetterContent object.

GetWorkflowTasks

Returns a WorkflowTasks collection that represents the workflow tasks assigned to a document.

GetWorkflowTemplates

Returns a WorkflowTemplates collection that represents the workflow templates attached to a document.

GoTo

Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.

LockServerFile

Locks the file on the server preventing anyone else from editing it.

MakeCompatibilityDefault

Sets the compatibility options.

ManualHyphenation

Initiates manual hyphenation of a document, one line at a time.

Merge

Merges the changes marked with revision marks from one document to another.

Post

Posts the specified document to a public folder in Microsoft Exchange. .

PresentIt

Opens PowerPoint with the specified Word document loaded.

PrintOut

Prints all or part of the specified document.

PrintPreview

Switches the view to print preview.

Protect

Protects the specified document from unauthorized changes.

Range

Returns a Range object by using the specified starting and ending character positions.

Redo

Redoes the last action that was undone (reverses the Undo method). Returns True if the actions were redone successfully.

RejectAllRevisions

Rejects all tracked changes in the specified document.

RejectAllRevisionsShown

Rejects all revisions in a document that are displayed on the screen.

Reload

Reloads a cached document by resolving the hyperlink to the document and downloading it.

ReloadAs

Reloads a document based on an HTML document, using the specified document encoding.

RemoveDocumentInformation

Removes sensitive information, properties, comments, and other metadata from a document.

RemoveLockedStyles

Purges a document of locked styles when formatting restrictions have been applied in a document.

RemoveNumbers

Removes numbers or bullets from the specified document.

RemoveTheme

Removes the active theme from the current document.

Repaginate

Repaginates the entire document.

ReplyWithChanges

Sends an e-mail message to the author of a document that has been sent out for review, notifying them that a reviewer has completed review of the document.

ResetFormFields

Clears all form fields in a document, preparing the form to be filled in again.

ReturnToLastReadPosition

Returns the active document to the last saved reading position, and returns an integer that represents that position.

RunAutoMacro

Runs an auto macro that's stored in the specified document. If the specified auto macro doesn't exist, nothing happens.

RunLetterWizard

Runs the Letter Wizard on the specified document.

Save

Saves all the documents in the Documents collection.

SaveAs2

Saves the specified document with a new name or format. Some of the arguments for this method correspond to the options in the Save As dialog box (File tab).

SaveAsQuickStyleSet

Saves the group of quick styles currently in use.

Select

Selects the contents of the specified document.

SelectAllEditableRanges

Selects all ranges for which the specified user or group of users has permission to modify.

SelectContentControlsByTag

Returns a ContentControls collection that represents all the content controls in a document with the tag value specified in the Tag parameter. Read-only.

SelectContentControlsByTitle

Returns a ContentControls collection that represents all the content controls in a document with the title specified in the Title parameter. Read-only.

SelectLinkedControls

Returns a ContentControls collection that represents all content controls in a document that are linked to the specific custom XML node in the document's XML data store as specified by the Node parameter. Read-only.

SelectNodes

Returns an XMLNodes collection that represents all the nodes that match the XPath parameter in the order in which they appear in the document or range.

SelectSingleNode

Returns an XMLNode object that represents the first node that matches the XPath parameter in the specified document.

SelectUnlinkedControls

Returns a ContentControls collection that represents all content controls in a document that are not linked to an XML node in the document's XML data store. Read-only.

SendFax

Sends the specified document as a fax, without any user interaction.

SendFaxOverInternet

Sends a document to a fax service provider, who faxes the document to one or more specfied recipients.

SendForReview

Sends a document in an e-mail message for review by the specified recipients.

SendMail

Opens a message window for sending the specified document through Microsoft Exchange.

SetCompatibilityMode

Sets the compatibility mode for the document.

SetDefaultTableStyle

Specifies the table style to use for newly created tables in a document.

SetLetterContent

Inserts the contents of the specified LetterContent object into a document.

SetPasswordEncryptionOptions

Sets the options Microsoft Word uses for encrypting documents with passwords.

ToggleFormsDesign

Switches form design mode on or off.

TransformDocument

Applies the specified Extensible Stylesheet Language Transformation (XSLT) file to the specified document and replaces the document with the results.

Undo

Undoes the last action or a sequence of actions, which are displayed in the Undo list. Returns True if the actions were successfully undone.

UndoClear

Clears the list of actions that can be undone for the specified document.

Unprotect

Removes protection from the specified document. .

UpdateStyles

Copies all styles from the attached template into the document, overwriting any existing styles in the document that have the same name.

ViewCode

Displays the code window for the selected Microsoft ActiveX control in the specified document.

ViewPropertyBrowser

Displays the property window for the selected Microsoft ActiveX control in the specified document.

WebPagePreview

Displays a preview of the current document as it would look if saved as a Web page.

Show: