Etudes for Microsoft Word Programmers. Appendix.


Information on this page is from Microsoft MSDN http://msdn.microsoft.com.

Object Document (Word 2003)

Document object contains properties and methods of Microsoft Word document.
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

Document Object Properties

The following table lists Document object properties.

Property

Type

Description

ActiveTheme

Read-only String

Returns the name of the active theme plus the theme formatting options for the specified document. Returns "none" if the document doesn't have an active theme.
Remarks
For an explanation of the value returned by this property, see the Name argument of the ApplyTheme method. The value returned by this property may not correspond to the theme's display name. To return a theme's display name, use the ActiveThemeDisplayName property.

ActiveThemeDisplayName

Read-only String

Returns the display name of the active theme for the specified document. Returns "none" if the document doesn't have an active theme.
Remarks
A theme's display name is the name that appears in the Theme dialog box. This name may not correspond to the string you would use to set a default theme or to apply a theme to a document.

ActiveWindow

Read-only

Returns a Window object that represents the active window (the window with the focus). If there are no windows open, an error occurs.

ActiveWritingStyle

(LanguageID)

Read/write String

Returns or sets the writing style for a specified language in the specified document.
Note  The WritingStyleList property returns an array of the names of the available writing styles.
LanguageID    Required Variant. The language to set the writing style for in the specified document. Can be either a string or one of the following WdLanguageID constants.
Remarks
Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
.ActiveWritingStyle(wdEnglishUS) = "Technical"

Application

 

Used without an object qualifier, this property returns an Application object that represents the Microsoft Word application. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Remarks
Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

AttachedTemplate

Read/write Variant

Returns a Template object that represents the template attached to the specified document. To set this property, specify either the name of the template or an expression that returns a Template object.

AutoFormatOverride

Read/write Boolean

Returns or sets a Boolean that represents whether automatic formatting options override formatting restrictions in a document where formatting restrictions are in effect.

AutoHyphenation

Read/write Boolean

True if automatic hyphenation is turned on for the specified document.

Background

Read-only

Returns a Shape object that represents the background image for the specified document.
Note  Backgrounds are visible only in web layout view.

Bookmarks

Read-only
Bookmarks collection

Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection.

BuiltInDocumentProperties

Document Properties collection

Returns a DocumentProperties collection that represents all the built-in document properties for the specified document.
expression.BuiltInDocumentProperties
expression Required. An expression that returns one of the objects in the Applies To list.

Remarks
To return a single DocumentProperty object that represents a specific built-in document property, use BuiltinDocumentProperties(index), where index is a WdBuiltInProperty constant. For a list of valid constants, consult the Microsoft Visual Basic Object Browser. For information about returning a single member of a collection, see Returning an Object from a Collection .
If Microsoft Word doesn't define a value for one of the built-in document properties, reading the Value property for that document property generates an error.
Use the CustomDocumentProperties property to return the collection of custom document properties.

Characters

Read-only

Returns a Characters collection that represents the characters in a document, range, or selection.

ChildNodeSuggestions

XML ChildNode Suggestions collection

Returns an XMLChildNodeSuggestions collection that represents the list of allowed elements for the Document object (which returns the root elements for all attached schemas) or for the XMLNode object (which returns the child elements of a specified element).
Note  Each XMLChildNodeSuggestion object in a XMLChildNodeSuggestions collection is an item in the list of allowed possible XML elements at the bottom of the XML Structure task pane.

ClickAndType ParagraphStyle

Read/write Variant

Returns or sets the default paragraph style applied to text by the Click and Type feature in the specified document. To set this property, specify either the local name of the style, an integer, or a WdBuiltinStyle constant, or an object that represents the style.
Remarks
For a list of the WdBuiltinStyle constants, consult the Microsoft Visual Basic Object Browser.
If the InUse property for the specified style is set to False, an error occurs.
For more information on Click and Type, see Overview of Click and Type .

CodeName

Read-only String

Returns the code name for the specified document.
Remarks
The code name is the name for the module that houses event macros for a document. The default name for the module is "ThisDocument"; you can view it in the Project window. For information about using events with the Document object, see Using Events with the Document Object.

CommandBars

CommandBars collection

Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.
Remarks
Use the CustomizationContext property to set the template or document context prior to accessing the CommandBars collection.

Comments

Read-only Comments collection

Returns a Comments collection that represents all the comments in the specified document, selection, or range.

Compatibility(Type)

Read/write Boolean

True if the compatibility option specified by the Type argument is enabled. Compatibility options affect how a document is displayed in Microsoft Word.
Type   Required WdCompatibility . The compatibility option.
Remarks
Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

ConsecutiveHyphensLimit

Read/write Long

Returns or sets the maximum number of consecutive lines that can end with hyphens.
Note  If this property is set to 0 (zero), any number of consecutive lines can end with hyphens.

Container

Read-only
object

Returns the object that represents the container application for the specified OLE object.
Remarks
This property provides access to the specified document's container application if the document is embedded in another application as an OLE object.
The Container property also provides a pathway into the object model of the container application if a Word document is opened as an ActiveX document — for example, when a Word document is opened in Microsoft Office Binder or Internet Explorer.

Content

Read-only
Range object

Returns a Range object that represents the main document story.
Remarks
The following two statements are equivalent:
Set mainStory = ActiveDocument.Content
Set mainStory = ActiveDocument.StoryRanges(wdMainTextStory)

Creator

Read-only Long

Returns a 32-bit integer that indicates the application in which the specified object was created. For example, if the object was created in Microsoft Word, this property returns the hexadecimal number 4D535744, which represents the string "MSWD." This value can also be represented by the constant wdCreatorCode.
Remarks
The Creator property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Custom DocumentProperties

Document Properties collection

Returns a DocumentProperties collection that represents all the custom document properties for the specified document.
Remarks
Use the BuiltInDocumentProperties property to return the collection of built-in document properties.
For information about returning a single member of a collection, see Returning an Object from a Collection .
Properties of type msoPropertyTypeString cannot exceed 255 characters in length.

DefaultTableStyle

Read-only
Variant

Returns a Variant that represents the table style that is applied to all newly created tables in a document.

DefaultTabStop

Read/write Single

Returns or sets the interval (in points) between the default tab stops in the specified document.

 

DefaultTargetFrame

Read/write
String

Returns or sets a String indicating the browser frame in which to display a Web page reached through a hyperlink.
Remarks
While the DefaultTargetFrame property can use any user-defined string, it has the following predefined strings: "_top", "_blank", "_parent", and "_self".

 

DisableFeatures

Read/write Boolean

True disables all features introduced after the version specified in the DisableFeaturesIntroducedAfter property. The default value is False.
Remarks
The DisableFeatures property only affects the document for which you set the property. Use this property if you plan on sharing a document between users with an earlier versions of Microsoft Word, so you don't end up introducing into a document features that are not available in their versions of Word.
Use the DisableFeaturesByDefault property to disable in all documents features introduced after a specified version.

 

DisableFeatures IntroducedAfter

Read/write WdDisable Features Introduced After .

Disables all features introduced after a specified version of Microsoft Word in the document only.
Remarks
The DisableFeatures property must be set to True prior to setting the DisableFeaturesIntroducedAfter property. Otherwise, the setting will not take effect and will remain at its default setting of Word 97 for Windows.
The DisableFeaturesIntroducedAfter property only affects the document for which the property is set. If you want to set a global option for the application to disable features for all documents, use the DisableFeaturesIntroducedAfterByDefault property.

DocumentLibraryVersions

Document Library Versions collection

Returns a DocumentLibraryVersions collection that represents the collection of versions of a shared document that has versioning enabled and that is stored in a document library on a server.

DoNotEmbedSystemFonts

Read/write Boolean

True for Microsoft Word to not embed common system fonts
Remarks
Setting the DoNotEmbedSystemFonts property to False is useful if the user is on an East Asian system and wants to create a document that is readable by others who do not have fonts for that language on their system. For example, a user on a Japanese system could choose to embed the fonts in a document so that the Japanese document would be readable on all systems.

Email

Read-only
Email object

Returns an Email object that contains all the e-mail – related properties of the current document.

EmbedLinguisticData

Read/write Boolean

True for Microsoft Word to embed speech and handwriting so that data can be converted back to speech or handwriting and to store East Asian IME keystrokes to improve correction; also controls text service data received from devices connected to Microsoft Office using the Windows Text Service Framework Application Programming Interface.

EmbedSmartTags

Read/write Boolean

True for Microsoft Word to save the smart tag information in a document.
Remarks
Use the EmbedSmartTags property when sending documents to users who may not have the smart tag recognizer file on their computer. This allows the recipient to still have access to the smart tag information (and to the related actions if they have the smart tag actions file on their computer). However, if a document containing smart tags is edited by a user with an earlier version of Word, the smart tag information is removed.

EmbedTrueTypeFonts

Read/write Boolean

True if Microsoft Word embeds TrueType fonts in a document when it's saved. This allow others to view the document with the same fonts that were used to create it.

Endnotes

Read-only
Endnotes collection

Returns an Endnotes collection that represents all the endnotes in a range, selection, or document.

EnforceStyle

Read/write Boolean

Returns or sets a Boolean that represents whether formatting restrictions are enforced in a protected document.

Envelope

Read-only
Envelope object

Returns an Envelope object that represents envelope functionality and the envelope in the specified document.

FarEastLine BreakLanguage

Read/write WdFarEast LineBreak LanguageID

Returns or sets the East Asian language to use when breaking lines of text in the specified document or template..

Fields

read-only Fields collection

Returns a read-only Fields collection that represents all the fields in the document, range, or selection.
Note  When applied to the Document object, the Fields property returns a Fields collection that contains only the fields in the main text story.

Footnotes

Read-only
Footnotes collection

Returns a Footnotes collection that represents all the footnotes in a range, selection, or document.

FormattingShowClear

Read/write Boolean

True for Microsoft Word to show clear formatting in the Styles and Formatting task pane.

FormattingShowFilter

Read/write WdShowFilter

Sets or returns a WdShowFilter constant that represents the styles and formatting displayed in the Styles and Formatting task pane.

FormattingShowFont

Read/write Boolean

True for Microsoft Word to display font formatting in the Styles and Formatting task pane.

FormattingShow Numbering

Read/write Boolean

True for Microsoft Word to display number formatting in the Styles and Formatting task pane.

FormattingShow Paragraph

Read/write Boolean

True for Microsoft Word to display paragraph formatting in the Styles and Formatting task pane.

FormFields

Read-only FormFields collection

Returns a FormFields collection that represents all the form fields in the document, range, or selection.

FormsDesign

Read-only Boolean

True if the specified document is in form design mode.
Note  This property always returns False if it's used in code run from Microsoft Word, but it returns the correct value if it is run through Automation. For example, if you run the example from Microsoft Excel, it will return True if you're in design mode.
Remarks
When Word is in form design mode, the Control Toolbox toolbar is displayed. You can use this toolbar to insert ActiveX controls such as command buttons, scroll bars, and option buttons. In form design mode, event procedures don't run, and when you click an embedded control, the control's sizing handles appear.

Frames

Read-only Frames collection

Returns a Frames collection that represents all the frames in a document, range, or selection.

Frameset

Read-only
Frameset object

Returns a Frameset object that represents an entire frames page or a single frame on a frames page.
Remarks
For more information on creating frames pages, see Creating frames pages .

 

FullName

Read-only String

Specifies the name of a document, template, or cascading style sheet, including the drive or Web path.

GrammarChecked

Read/write Boolean

True if a grammar check has been run on the specified range or document. False if some of the specified range or document hasn't been checked for grammar.
Remarks
To recheck the grammar in a range or document, set the GrammarChecked property to False.

GrammaticalErrors

Read-only
Proofreading Errors collection

Returns a ProofreadingErrors collection that represents the sentences that failed the grammar check on the specified document or range. There can be more than one error per sentence.
For information about returning a single member of a collection, see Returning an Object from a Collection .
Remarks
If there are no grammatical errors, the Count property for the ProofreadingErrors object returned by the GrammaticalErrors property returns 0 (zero).

GridDistanceHorizontal

Read/write Single

Returns or sets the amount of horizontal space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document.

GridDistanceVertical

Read/write Single

Returns or sets the amount of vertical space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document.

GridOriginFromMargin

Read/write Boolean

True if Microsoft Word starts the character grid from the upper-left corner of the page.

 

GridOriginHorizontal

Read/write Single

Returns or sets the point, relative to the left edge of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document.

GridOriginVertical

Read/write Single

Returns or sets the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document.

GridSpaceBetween HorizontalLines

Read/write Long

Returns or sets the interval at which Microsoft Word displays horizontal character gridlines in print layout view.

GridSpaceBetween VerticalLines

Read/write Long

Returns or sets the interval at which Microsoft Word displays vertical character gridlines in print layout view.

HasPassword

Read-only Boolean

True if a password is required to open the specified document.

HasRoutingSlip

Read/write Boolean

True if the specified document has a routing slip attached to it. Setting this property to True creates a routing slip; setting it to False deletes the routing slip.

HTMLDivisions

HTML Divisions object

Returns an HTMLDivisions object that represents an HTML division in a Web document.

HTMLProject

HTMLProject object

Returns an HTMLProject object in the specified document that represents a top-level project branch, as in the Project Explorer of the Microsoft Script Editor.

Hyperlinks

Read-only Hyperlinks collection

Returns a Hyperlinks collection that represents all the hyperlinks in the specified document, range, or selection.

HyphenateCaps

Read/write Boolean

True if words in all capital letters can be hyphenated.

HyphenationZone

Read/write Long

Returns or sets the width of the hyphenation zone, in points. The hyphenation zone is the maximum amount of space that Microsoft Word leaves between the end of the last word in a line and the right margin.

 Indexes

Read-only Indexes collection

Returns an Indexes collection that represents all the indexes in the specified document.

InlineShapes

Read-only InlineShapes collection

Returns an InlineShapes collection that represents all the InlineShape objects in a document, range, or selection.

IsMasterDocument

Read-only Boolean

True if the specified document is a master document. A master document includes one or more subdocuments.

IsSubdocument

Read-only Boolean

True if the specified document is opened in a separate document window as a subdocument of a master document.

JustificationMode

Read/write WdJustificationMode

Returns or sets the character spacing adjustment for the specified document.

KerningByAlgorithm

Read/write Boolean

True if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document.

Kind

Read/write WdDocumentKind

Returns or sets the format type that Microsoft Word uses when automatically formatting the specified document.

LanguageDetected

Read/write Boolean

Returns or sets a value that specifies whether Microsoft Word has detected the language of the specified text.
Remarks
Check the LanguageID property for the results of any previous language detection.
The LanguageDetected property is set to True when the DetectLanguage method is called. To reevaluate the language of the specified text, you must first set the LanguageDetected property to False.
For more information about automatic language detection, see About automatic language detection .

ListParagraphs

Read-only ListParagraphs collection

Returns a ListParagraphs collection that represents all the numbered paragraphs in the list, document, or range.

Lists

Read-only Lists collection

Returns a Lists collection that contains all the formatted lists in the specified document.

ListTemplates

Read-only ListTemplates collection

Returns a ListTemplates collection that represents all the list formats for the specified document, template, or list gallery.

MailEnvelope

MsoEnvelope object

Returns an MsoEnvelope object that represents an e-mail header for a document.

MailMerge

Read-only MailMerge object

Returns a MailMerge object that represents the mail merge functionality for the specified document.
Note  The MailMerge object is available regardless of whether the specified document is a mail merge main document. Use the State property to determine the current state of the mail merge operation.

Name

read-only String

Returns the name of the specified object.

NoLineBreakAfter

Read/write String

Returns or sets the kinsoku characters after which Microsoft Word will not break a line.

NoLineBreakBefore

Read/write String

Returns or sets the kinsoku characters before which Microsoft Word will not break a line.

OpenEncoding

Read-only MsoEncoding .

Returns the encoding used to open the specified document.

OptimizeForWord97

Read/write Boolean

True if Microsoft Word optimizes the current document for viewing in Word 97 by disabling any incompatible formatting.
Remarks
To optimize all new documents for Word 97 by default, use the OptimizeForWord97byDefault property.

PageSetup

Read-only PageSetup object

Returns a PageSetup object that's associated with the specified document, range, section, sections, or selection.

Paragraphs

Read-only Paragraphs collection

Returns a Paragraphs collection that represents all the paragraphs in the specified document, range, or selection.

Parent

TextFrame object

For the TextFrame object, returns a Shape object representing the parent shape of the text frame. For all other objects, returns an object that represents the parent object of the specified object.

Password

Write-only String

Sets a password that must be supplied to open the specified document.
Security   Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

PasswordEncryption Algorithm

Read-only String

Returns a String indicating the algorithm Microsoft Word uses for encrypting documents with passwords.
Remarks
Use the SetPasswordEncryptionOptions method to specify the algorithm Word uses for encrypting documents with passwords.

PasswordEncryption FileProperties

Read-only Boolean

True if Microsoft Word encrypts file properties for password-protected documents.
Remarks
Use the SetPasswordEncryptionOptions method to specify whether Word encrypts file properties for password-protected documents.

PasswordEncryption KeyLength

Read-only Long

Returns a Long indicating the key length of the algorithm Microsoft Word uses when encrypting documents with passwords.
Remarks
Use the SetPasswordEncryptionOptions method to specify the key length Word uses when encrypting documents with passwords.

PasswordEncryption Provider

Read-only String

Returns a String specifying the name of the algorithm encryption provider that Microsoft Word uses when encrypting documents with passwords.
Remarks
Use the SetPasswordEncryptionOptions method to specify the name of the algorithm encryption provider Word uses when encrypting documents with passwords.

Path

Read-only String

Returns the disk or Web path to the specified object.
Remarks
The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path and use the FullName property to return the file name and the path together.
Note  You can use the PathSeparator property to build Web addresses even though they contain forward slashes (/) and the PathSeparator property defaults to a backslash (\).

Permission

Permission object

Returns a Permission object that represents the permission settings in the specified document.

 

PrintFormsData

Read/write Boolean

True if Microsoft Word prints onto a preprinted form only the data entered in the corresponding online form.

 

PrintFractionalWidths

Read/write Boolean

True if the specified document is formatted to use fractional point spacing to display and print characters.
Note  In Windows, this property always returns False. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

PrintPostScript OverText

Read/write Boolean

True if PRINT field instructions (such as PostScript commands) in a document are to be printed on top of text and graphics when a PostScript printer is used.
Remarks
This property controls whether postscript code is printed in a converted Microsoft Word for Macintosh document. If the document contains no PRINT fields, this property has no effect.

PrintRevisions

Read/write Boolean

True if revision marks are printed with the document. False if revision marks aren't printed (that is, tracked changes are printed as if they'd been accepted).

ProtectionType

WdProtectionType constant

Returns the protection type for the specified document. Can be one of the following WdProtectionType constants: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions, or wdNoProtection.

ReadabilityStatistics

Read-only Readability Statistics collection

Returns a ReadabilityStatistics collection that represents the readability statistics for the specified document or range.

ReadingLayoutFrozen

Boolean

Sets or returns a Boolean that represents whether pages displayed in reading layout view are frozen to a specified size for inserting handwritten markup into a document.

ReadingLayoutSizeX

Long

Sets or returns a Long that represents the width of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.
Remarks
After setting the ReadingLayoutSizeX and Visit ReadingLayoutSizeY properties, use the ReadingModeLayoutFrozen property to display the page using the specified height and width. Use the ReadingLayout property to display a document in reading layout view.

ReadingLayoutSizeY

Long

Sets or returns a Long that represents the height of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.
Remarks
After setting the ReadingLayoutSizeX and ReadingLayoutSizeY properties, use the ReadingModeLayoutFrozen property to display the page using the specified height and width. Use the ReadingLayout property to display a document in reading layout view.

ReadOnly

Read-only Boolean

True if changes to the document cannot be saved to the original document.
Note   The active grammar, hyphenation, spelling, and thesaurus dictionaries are Read-only Custom dictionaries are Read/write.

ReadOnly Recommended

Read/write Boolean

True if Word displays a message box whenever a user opens the document, suggesting that it be opened as Read-only.

RemoveDateAndTime

Boolean

Sets or returns a Boolean indicating whether a document stores the date and time meta data for tracked changes. True removes date and time stamp information from tracked changes. False does not remove date and time stamp information from tracked changes.
Remarks
Use in conjunction with the RemovePersonalInformation property to help remove personal information from the document properties.

RemovePersonal Information

Read/write Boolean

True if Microsoft Word removes all user information from comments, revisions, and the Properties dialog box upon saving a document.

Revisions

Read-only Revisions collection

Returns a Revisions collection that represents the tracked changes in the document or range.

 

Routed

Read-only Boolean

True if the specified document has been routed to the next recipient. False if the document has yet to be routed (for example, if the document has no routing slip, or if a routing slip was just created).

RoutingSlip

Read-only RoutingSlip object

Returns a RoutingSlip object that represents the routing slip information for the specified document. A routing slip is used to send a document through an electronic mail system.

Saved

Read/write Boolean

True if the specified document or template hasn't changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed.

SaveEncoding

Read/write MsoEncoding .

Returns or sets the encoding to use when saving a document.

SaveFormat

Read-only Long

Returns the file format of the specified document or file converter. Will be a unique number that specifies an external file converter or a WdSaveFormat constant.

SaveFormsData

Read/write Boolean

True if Microsoft Word saves the data entered in a form as a tab-delimited record for use in a database.

SaveSubsetFonts

Read/write Boolean

True if Microsoft Word saves a subset of the embedded TrueType fonts with the document.
Remarks
If fewer than 32 characters of a TrueType font are used in a document, Word embeds the subset (only the characters used) in the document. If more than 32 characters are used, Word embeds the entire font.

Scripts

Scripts collection

Returns a Scripts collection that represents the collection of HTML scripts in the specified object.

Sections

Read-only Sections collection

Returns a Sections collection that represents the sections in the specified document, range, or selection.

Sentences

Read-only Sentences collection

Returns a Sentences collection that represents all the sentences in the range, selection, or document.

Shapes

Read-only Shapes collection

Returns a Shapes collection that represents all the Shape objects in the specified document, header, or footer. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.
Remarks
The Shapes property, when applied to a document, returns all the Shape objects in the main story of the document, excluding the headers and footers. When applied to a HeaderFooter object, the Shapes property returns all the Shape objects found in all the headers and footers in the document.

SharedWorkspace

Shared Workspace object

Returns a SharedWorkspace object that represents the Document Workspace in which a specified document is located.

 ShowGrammatical Errors

Read/write Boolean

True if grammatical errors are marked by a wavy green line in the specified document.
Note  To view grammatical errors in your document, you must set the CheckGrammarAsYouType property to True.

 ShowRevisions

Read/write Boolean

True if tracked changes in the specified document are shown on the screen.

ShowSpellingErrors

Read/write Boolean

True if Microsoft Word underlines spelling errors in the document.
Remarks
To view spelling errors in a document, you must set the CheckSpellingAsYouType property to True.

 ShowSummary

Read/write Boolean

True if an automatic summary is displayed for the specified document.

Signatures

SignatureSet object

Returns a SignatureSet object that represents the digital signatures for a document.
Remarks
To digitally sign Microsoft Word documents and verify other signatures in them, you will need the Microsoft CryptoAPI and a unique digital signature certificate. The CryptoAPI is installed with Microsoft Internet Explorer 4.01 and higher. You can obtain a digital signature certificate from a certification authority.

SmartDocument

Smart Document object

Returns a SmartDocument object that represents the settings for a smart document solution.
Remarks
For more information on smart documents, please see the Smart Document Software Development Kit on the Microsoft Developer Network (MSDN) Web site.

SmartTags

SmartTags object

Returns a SmartTags object that represents a smart tag in a document.

SmartTags AsXMLProps

Read/write Boolean

True for Microsoft Word to create an XML header containing smart tag information when a document containing smart tags is saved as HTML.

SnapToGrid

Read/write Boolean

True if AutoShapes or East Asian characters are automatically aligned with an invisible grid when they are drawn, moved, or resized in the specified document.
Remarks
You can temporarily override this setting by pressing ALT while drawing, moving, or resizing an AutoShape.

SnapToShapes

Read/write Boolean

True if Microsoft Word automatically aligns AutoShapes or East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes or East Asian characters in the specified document.
Remarks
This property creates additional invisible gridlines for each AutoShape. SnapToShapes works independently of the SnapToGrid property.

 SpellingChecked

Read/write Boolean

True if spelling has been checked throughout the specified range or document. False if all or some of the range or document hasn't been checked for spelling.
Remarks
To recheck the spelling in a range or document, set the SpellingChecked property to False.
To see whether the range or document contains spelling errors, use the SpellingErrors property.

SpellingErrors

Read-only Proofreading Errors collection

Returns a ProofreadingErrors collection that represents the words identified as spelling errors in the specified document or range.

 StoryRanges

Read-only StoryRanges collection

Returns a StoryRanges collection that represents all the stories in the specified document.

Styles

Read-only Styles collection

Returns a Styles collection for the specified document.

StyleSheets

StyleSheets object

Returns a StyleSheets object that represents the Web style sheets attached to a document.

 Subdocuments

Read-only Subdocuments collection

Returns a Subdocuments collection that represents all the subdocuments in the specified range or document.

SummaryLength

Read/write Long

Returns or sets the length of the summary as a percentage of the document length. The larger the number, the more detail that's included in the summary.
Note  This property takes effect immediately if the AutoSummarize toolbar is displayed; otherwise, it takes effect the next time the AutoSummarize method or the SummaryViewMode property is applied to the document.

SummaryViewMode

Read/write WdSummary Mode.

Returns or sets the way a summary is displayed. This property corresponds to Type of summary in the AutoSummarize dialog box (Tools menu).
Can be one of the following WdSummaryMode constants.

Sync

Sync object

Returns a Sync object that provides access to the methods and properties for documents that are part of a Document Workspace.

Tables

Read-only Tables collection

Returns a Tables collection that represents all the tables in the specified cell, document, range, selection, or table.

TablesOfAuthorities

Read-only TablesOf Authorities collection

Returns a TablesOfAuthorities collection that represents the tables of authorities in the specified document.

TablesOfAuthorities Categories

Read-only TablesOf Authorities Categories collection

Returns a TablesOfAuthoritiesCategories collection that represents the available table of authorities categories for the specified document.

TablesOfContents

Read-only TablesOf Contents collection

Returns a TablesOfContents collection that represents the tables of contents in the specified document.

TablesOfFigures

Read-only TablesOf Figures collection

Returns a TablesOfFigures collection that represents the tables of figures in the specified document.

TextEncoding

Read/write MsoEncoding

Returns or sets the code page, or character set, that Microsoft Word uses for a document saved as an encoded text file.
Remarks
XXXAutoDetect constants are Not used with this property.

The TextEncoding property sets text encoding separately from HTML encoding, which you can set using the Encoding property. To set text encoding for all documents saved as text files, use the DefaultTextEncoding property.

TextLineEnding

Read/write

WdLineEndingType constant

Returns or sets a WdLineEndingType constant indicating how Microsoft Word marks the line and paragraph breaks in documents saved as text files.

TrackRevisions

Read/write Boolean

True if changes are tracked in the specified document.

Type

Read-only WdDocument Type

Returns the document type (template or document).
Remarks
The Type property returns wdMasterView for all documents where the current view is an outline or a master document. The current view will never return wdOutlineView unless explicitly set first in code.

To check whether the current document is an outline, use the Type property and the Subdocuments collection's Count property. If the Type property returns either wdOutlineView or wdMasterView and the Count property returns zero, the document is an outline.

UpdateStylesOnOpen

Read/write Boolean

True if the styles in the specified document are updated to match the styles in the attached template each time the document is opened.

UserControl

Boolean

True if the document or application was created or opened by the user. False if the document or application was created or opened programmatically from another Microsoft Office application with the Open method or the CreateObject or GetObject method. Read/write Boolean for the Document object; read-only Boolean for the Application object.
Remarks
If Word is visible to the user, or if you call the UserControl property of a Word Application or Document object from within a Word code module, this property will always return True.

Variables

Read-only Variables collection

Returns a Variables collection that represents the variables stored in the specified document.

VBASigned

Read-only Boolean

True if the Visual Basic for Applications (VBA) project for the specified document has been digitally signed.

VBProject

VBProject object

Returns the VBProject object for the specified template or document.
expression.VBProject
Remarks
Use this property to gain access to code modules and user forms.
To view the VBProject object in the object browser, you must select the Microsoft Visual Basic for Applications Extensibility check box in the References dialog box (Tools menu) in the Visual Basic Editor.

Versions

Read-only Versions collection

Returns a Versions collection that represents all the versions of the specified document.

WebOptions

Read-only WebOptions object

Returns the WebOptions object, which contains document-level attributes used by Microsoft Word when you save a document as a Web page or open a Web page.

Windows

Read-only Windows collection

Returns a Windows collection that represents all windows for the specified document (for example, Sales.doc:1 and Sales.doc:2).

Words

Read-only Words collection

Returns a Words collection that represents all the words in a range, selection, or document.
Note  Punctuation and paragraph marks in a document are included in the Words collection.

WritePassword

Write-only String

Sets a password for saving changes to the specified document.
Security   Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

WriteReserved

Read-only Boolean

True if the specified document is protected with a write password.

XMLHideNamespaces

Boolean

Returns a Boolean that represents whether to hide the XML namespaces in the list of elements in the XML Structure task pane. True shows the elements with the XML schema namespace for the element to the right of the element name. False does not display the XML schema namespace.
Remarks
Setting the XMLHideNamespaces property to False may be helpful when multiple schemas that contain similar or identical element names are attached to the same document.

XMLNodes

XMLNodes collection

Returns an XMLNodes collection that represents the collection of all XML elements within a document or in a selection or range—including those elements that are only partially within the selection or range.

XMLSaveDataOnly

Boolean

Sets or returns a Boolean that represents whether a document is saved with the XML markup or as text only. True indicates that Microsoft Word will save a document with custom XML markup and related content only. False indicates that Word will save a document with the full XML markup.

XMLSave ThroughXSLT

String

Sets or returns a String that specifies the path and file name for the Extensible Stylesheet Language Transformation (XSLT) to apply when a user saves a document.
Remarks
The XMLSaveThroughXSLT property is only applicable when the XMLUseXSLTWhenSaving property is set to True. If the XMLUseXSLTWhenSaving property is set to False, Microsoft Word will ignore the XMLSaveThroughXSLT property.

XMLSchemaReferences

XMLSchema References collection

Returns an XMLSchemaReferences collection that represents the schemas attached to a document.

XMLSchemaViolations

XMLNodes collection

Returns an XMLNodes collection that represents all nodes in the document that have validation errors.

XMLShow AdvancedErrors

Boolean

Returns or sets a Boolean that represents whether error message text is generated from the built-in Microsoft Word error messages or from the Microsoft XML Core Services (MSXML) 5.0 component included with Office.
Remarks
Using advanced error messages from the MSXML 5.0 component provides more specific error messages. There are approximately 500 error messages provided through the XML Core Services that are accessible when the XMLShowAdvancedErrors property is True.

Word has approximately 50 built-in generic schema errors. When the XMLShowAdvancedErrors property is False, Word uses the built-in error messages for errors generated in XML documents.

XMLUseXSLT WhenSaving

Boolean

Returns a Boolean that represents whether to save a document through an Extensible Stylesheet Language Transformation (XSLT). True saves a document through an XSLT.
Remarks
When setting the XMLUseXSLTWhenSaving property to True, use the XMLSaveThroughXSLT property to specify the path and file name of the XSLT to use.

Document Object Methods

The following table lists Document object methods.

Method

Description

AcceptAllRevisions

Accepts all tracked changes in the specified document.

AcceptAllRevisionsShown

Accepts all revisions in the specified document that are displayed on the screen.
Remarks
Use the RejectAllRevisionsShown method to reject all revisions in a specified document that are displayed on the screen.

Activate

Activates the specified object.

AddToFavorites

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

ApplyTheme(Name)

Applies a theme to an open document.

Name    Required String The name of the theme plus any theme formatting options you want to apply. The format of this string is "theme nnn" where theme and nnn are defined as follows:

String

Description

theme

The name of the folder that contains the data for the requested theme. (The default location for theme data folders is C:\Program Files\Common Files\Microsoft Shared\Themes.) You must use the folder name for the theme rather than the display name that appears in the Theme dialog box (Theme command, Format menu).

nnn

A three-digit string that indicates which theme formatting options to activate (1 to activate, 0 to deactivate). The digits correspond to the Vivid Colors, Active Graphics, and Background Image check boxes in the Theme dialog box (Theme command, Format menu). If this string is omitted, the default value for nnn is "011" (Active Graphics and Background Image are activated).

AutoFormat

Automatically formats a document. Use the Kind property to specify a document type.

AutoSummarize(
Length,
Mode,
UpdateProperties
)
 

Creates an automatic summary of the specified document, and returns a Range object. Corresponds to the options in AutoSummarize dialog box.
Length    Optional Variant. The length of the summary as a percentage of the total document length (the larger the number, the more detail that's included in the summary).
Mode    Optional Variant. Specifies the way the summary is displayed. Can be one of the following WdSummaryMode constants.
UpdateProperties    Optional Variant. True to update the Keyword and Comments boxes in the Properties dialog box to reflect the content of the summary for the specified document.

CanCheckin

True if Microsoft Word can check in a specified document to a server. Read/write Boolean
Remarks
To take advantage of the collaboration features built into Word, documents must be stored on a Microsoft SharePoint Portal Server.

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. If the document or range contains errors, this method displays the Spelling and Grammar dialog box (Tools menu), with the Check grammar check box selected. When applied to a document, this method checks all available stories (such as headers, footers, and text boxes).

CheckIn(
SaveChanges,
MakePublic,
Comments
)

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.
SaveChanges   Optional Boolean True saves the document to the server location. The default is True.
MakePublic   Optional Boolean True allows the user to perform a publish on the document after being checked in. This submits the document for the approval process, which can eventually result in a version of the document being published to users with read-only rights to the document (only applies if SaveChanges equals True).
Comments   Optional Variant. Comments for the revision of the document being checked in (only applies if SaveChanges equals True).
Remarks
To take advantage of the collaboration features built into Word, documents must be stored on a Microsoft SharePoint Portal Server.

CheckNewSmartTags

Accesses the Microsoft Office Web site for available smart tag recognizer and action files.
Remarks
The CheckNewSmartTags method is equivalent to clicking the More Smart Tags button on the Smart Tags tab of the AutoCorrect dialog box (Tools menu).

CheckSpelling(
CustomDictionary, IgnoreUppercase, AlwaysSuggest, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10
)

Begins a spelling check for the specified document or range. If the document or range contains errors, this method displays the Spelling and Grammar dialog box (Tools menu), with the Check grammar check box cleared. For a document, this method checks all available stories (such as headers, footers, and text boxes).
expression Required. An expression that returns a Document or Range object.
CustomDictionary   Optional Variant. Either an expression that returns a Dictionary object or the file name of the custom dictionary.
IgnoreUppercase   Optional Variant. True if capitalization is ignored. If this argument is omitted, the current value of the IgnoreUppercase property is used.
AlwaysSuggest   Optional Variant. True for Microsoft Word to always suggest alternative spellings. If this argument is omitted, the current value of the SuggestSpellingCorrections property is used.
CustomDictionary2 – CustomDictionary10    Optional Variant. Either an expression that returns a Dictionary object or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

Close(
SaveChanges,
OriginalFormat,
RouteDocument
)

Closes the specified document or documents.
SaveChanges   Optional Variant. Specifies the save action for the document. Can be one of the following WdSaveOptions constants: wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.
OriginalFormat   Optional Variant. Specifies the save format for the document. Can be one of the following WdOriginalFormat constants: wdOriginalDocumentFormat, wdPromptUser, or wdWordDocument.
RouteDocument   Optional Variant. True to route the document to the next recipient. If the document doesn't have a routing slip attached, this argument is ignored.

ClosePrintPreview

Switches the specified document from print preview to the previous view. If the specified document isn't in print preview, an error occurs.

Compare(
Name,
AuthorName, CompareTarget, DetectFormatChanges, IgnoreAllComparisonWarnings, AddToRecentFiles, RemovePersonalInformation, RemoveDateAndTime
)

Displays revision marks that indicate where the specified document differs from another document.
Name   Required String The name of the document with which the specified document is compared.
AuthorName   Optional Variant. The reviewer name associated with the differences generated by the comparison. If unspecified, the value defaults to the author name of the revised document or the string "Comparison" if no author information is present.
CompareTarget   Optional Variant. The target document for the comparison. Can be any WdCompareTarget constant.
DetectFormatChanges   Optional Boolean True (default) for the comparison to include detection of format changes.
IgnoreAllComparisonWarnings   Optional Variant. True compares the documents without notifying a user of problems. The default value is False.
AddToRecentFiles   Optional Variant. True adds the document to the list of recently used files on the File menu.
RemovePersonalInformation   Optional Boolean True removes all user information from comments, revisions, and the properties dialog box in the returned Document object . The default value is False.
RemoveDateAndTime   Optional Boolean True removes date and time stamp information from tracked changes in the returned Document object. The default value is False.

ComputeStatistics (
Statistic,
IncludeFootnotesAndEndnotes
)

Returns a statistic based on the contents of the specified range. Long
Statistic   Required WdStatistic .
IncludeFootnotesAndEndnotes   Optional Variant. True to include footnotes and endnotes when computing statistics. If this argument is omitted, the default value is False.
Remarks
Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

ConvertNumbersToText
(NumberType)

Changes the list numbers and LISTNUM fields in the specified Document, List, or ListFormat object to text.
NumberType    Optional Variant. The type of number to be converted. Can be any of the following WdNumberType constant.
Remarks
There are two types of numbers: preset numbers (wdNumberParagraph), which you can add to paragraphs by selecting a template in the Bullets and Numbering dialog box; and LISTNUM fields (wdNumberListNum), which allow you to add more than one number per paragraph.
The ConvertNumbersToText method is useful if you want to work with a document in another application and that application doesn't recognize list formatting or LISTNUM fields.
After you've converted list numbers to text, you can no longer manipulate them in a list.

ConvertVietDoc
(CodePageOrigin)

Reconverts a Vietnamese document to Unicode using a code page other than the default.
CodePageOrigin   Required Long The original code page used to encode the document.
Remarks
Use the ConvertVietDoc method if you want a document to be viewable on another computer or platform.

CopyStylesFromTemplate
(Template)

Copies styles from the specified template to a document.
Template    Required String The template file name.
Remarks
When styles are copied from a template to a document, like-named styles in the document are redefined to match the style descriptions in the template. Unique styles from the template are copied to the document. Unique styles in the document remain intact.

CountNumberedItems(
NumberType,
Level
)

Returns the number of bulleted or numbered items and LISTNUM fields in the specified Document, List, or ListFormat object.
NumberType    Optional Variant. The type of numbers to be counted. Can be one of the following WdNumberType constants: wdNumberParagraph, wdNumberListNum, or wdNumberAllNumbers. The default value is wdNumberAllNumbers.
Level    Optional Variant. A number that corresponds to the numbering level you want to count. If this argument is omitted, all levels are counted.
Remarks
Bulleted items are counted when either wdNumberParagraph or wdNumberAllNumbers (the default) is specified for NumberType.

There are two types of numbers: preset numbers (wdNumberParagraph), which you can add to paragraphs by selecting a template in the Bullets and Numbering dialog box; and LISTNUM fields (wdNumberListNum), which allow you to add more than one number per paragraph.

CreateLetterContent(
DateFormat, IncludeHeaderFooter, PageDesign, LetterStyle, Letterhead, LetterheadLocation, LetterheadSize, RecipientName, RecipientAddress, Salutation, SalutationType, RecipientReference, MailingInstructions, AttentionLine, Subject, CCList, ReturnAddress, SenderName, Closing, SenderCompany, SenderJobTitle, SenderInitials, EnclosureNumber, InfoBlock, RecipientCode, RecipientGender, ReturnAddressShortForm, SenderCity, SenderCode, SenderGender, SenderReference)

Creates and returns a LetterContent object based on the specified letter elements. LetterContent object.
DateFormat   Required String The date for the letter.
IncludeHeaderFooter   Required Boolean True to include the header and footer from the page design template.
PageDesign   Required String The name of the template attached to the document.
LetterStyle   Required WdLetterStyle . The document layout.
Letterhead   Required Boolean True to reserve space for a preprinted letterhead.
LetterheadLocation   Required WdLetterheadLocation . The location of the preprinted letterhead.
LetterheadSize   Required Single The amount of space (in points) to be reserved for a preprinted letterhead.
RecipientName   Required String The name of the person who'll be receiving the letter.
RecipientAddress   Required String The mailing address of the person who'll be receiving the letter.
Salutation   Required String The salutation text for the letter.
SalutationType   Required WdSalutationType . The salutation type for the letter.
RecipientReference   Required String The reference line text for the letter (for example, "In reply to:").
MailingInstructions   Required String The mailing instruction text for the letter (for example, "Certified Mail").
AttentionLine   Required String The attention line text for the letter (for example, "Attention:").
Subject   Required String The subject text for the specified letter.
CCList   Required String The names of the carbon copy (CC) recipients for the letter.
ReturnAddress   Required String The text of the return mailing address for the letter.
SenderName   Required String The name of the person sending the letter.
Closing   Required String The closing text for the letter.
SenderCompany   Required String The company name of the person creating the letter.
SenderJobTitle   Required String The job title of the person creating the letter.
SenderInitials   Required String The initials of the person creating the letter.
EnclosureNumber   Required Long The number of enclosures for the letter.
InfoBlock   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
RecipientCode   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
RecipientGender   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
ReturnAddressShortForm   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderCity   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderCode   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderGender   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderReference   Optional Variant. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

DataForm

Displays the Data Form dialog box, in which you can add, delete, or modify data records.
Note  You can use this method with a mail merge main document, a mail merge data source, or any document that contains data delimited by table cells or separator characters.

DeleteAllComments

Deletes all comments from the Comments collection in a document.
Remarks
Use the Add method for the Comments object to add a comment to a document.

DeleteAllCommentsShown

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

DeleteAllEditableRanges(
EditorID
)

Deletes permissions in all ranges for which the specified user or group of users has permission to modify.
EditorID    Optional Variant. Can be either a String that represents the user's e-mail alias (if in the same domain), an e-mail address, or a WdEditorType constant that represents a group of users. If omitted, no permissions are deleted from a document.
wdEditorType can be one of the following wdEditorType constants.
Remarks
You can also use the DeleteAll method for the Editor object to delete permissions in all ranges for which a specified user or group of users has permission to modify.

DeleteAllInkAnnotations

Deletes all handwritten ink annotations in a document.
Remarks
To work with ink annotations, you must be running Microsoft Word on a tablet computer. For more information on adding handwritten ink annotations to a document, see "Mark up a document with ink annotations" in Microsoft Word Help.

DetectLanguage

Analyzes the specified text to determine the language that it is written in.
Remarks
The results of the DetectLanguage method are stored in the LanguageID property on a character-by-character basis. To read the LanguageID property, you must first specify a selection or range of text.
When applied to a Document object, the DetectLanguage method checks all available text in the document (headers, footers, text boxes, and so forth). If the specified text contains a partial sentence, the selection or range is extended to the end of the sentence.
If the DetectLanguage method has already been applied to the specified text, the LanguageDetected property is set to True. To reevaulate the language of the specified text, you must first set the LanguageDetected property to False.

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.
Remarks
When executed, the EndReview method displays a message asking the user whether to end the review.

FitToPages

Decreases the font size of text just enough so that the document will fit on one fewer pages. An error occurs if Word is unable to reduce the page count by one.

FollowHyperlink(
Address,
SubAddress,
NewWindow,
AddHistory,
ExtraInfo,
Method,
HeaderInfo
)

Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.
Note  If the hyperlink uses the file protocol, this method opens the document instead of downloading it.
Address    Required String The address of the target document.
SubAddress    Optional Variant. The location within the target document. The default value is an empty String
NewWindow    Optional Variant. True to display the target location in a new window. The default value is False.
AddHistory    Optional Variant. True to add the link to the current day's history folder.
ExtraInfo    Optional Variant. A string or a byte array that specifies additional information for HTTP to use to resolve the hyperlink. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name. The string is either posted or appended, depending on the value of Method. Use the ExtraInfoRequired property to determine whether extra information is required.
Method    Optional Variant. Specifies the way additional information for HTTP is handled. MsoExtraInfoMethod. Can be one of the following MsoExtraInfoMethod constants.

Constant

Description

msoMethodGet

ExtraInfo is a string that's appended to the address.

msoMethodPost

ExtraInfo is posted as a string or a byte array.

HeaderInfo    Optional Variant. A string that specifies header information for the HTTP request. The default value is an empty String You can combine several header lines into a single string by using the following syntax: "string1" & vbCr & "string2". The specified string is automatically converted into ANSI characters. Note that the HeaderInfo argument may overwrite default HTTP header fields.

GetCrossReferenceItems(
ReferenceType
)

Returns an array of items that can be cross-referenced based on the specified cross-reference type. The array corresponds to the items listed in the For which box in the Cross-reference dialog box (Insert menu).
Note  An item returned by this method can be used as the ReferenceWhich argument for the InsertCrossReference method.
ReferenceType    Required Variant. The type of item you want to insert a cross-reference to. WdReferenceType.

GetLetterContent

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

GoTo(
What,
Which,
Count,
Name
)

Document or Range object: Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.
What   Optional Variant. The kind of item to which the range or selection is moved. Can be one of the WdGoToItem constants.
Which   Optional Variant. The item to which the range or selection is moved. Can be one of the WdGoToDirection constants. The following examples are functionally equivalent; they both move the selection to the first heading in the document.
Count   Optional Variant. The number of the item in the document. The default value is 1. The following example moves the selection to the fourth line in the document.
Only positive values are valid. To specify an item that precedes the range or selection, use wdGoToPrevious as the Which argument and specify a Count value. The following example moves the selection up two lines.
Name   Optional Variant. If the What argument is wdGoToBookmark, wdGoToComment, wdGoToField, or wdGoToObject, this argument specifies a name. The following example moves to the next DATE field.
Remarks
When you use the GoTo method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range that's returned includes any grammar error text or spelling error text.

MakeCompatibilityDefault

Sets the compatibility options on the Compatibility tab in the Options dialog box (Tools menu) as the default settings for new documents.

ManualHyphenation

Initiates manual hyphenation of a document, one line at a time. The user is prompted to accept or decline suggested hyphenations.

Merge(
Name,
MergeTarget,
DetectFormatChanges,
UseFormattingFrom,
AddToRecentFiles
)

Merges the changes marked with revision marks from one document to another.
Name  Required String
MergeTarget  Optional WdMergeTarget.
DetectFormatChanges  Optional Boolean
UseFormattingFrom  Optional WdUseFormattingFrom.
AddToRecentFiles  Optional Boolean

Post

Posts the specified document to a public folder in Microsoft Exchange. This method displays the Send to Exchange Folder dialog box so that a folder can be selected.

PresentIt

Opens PowerPoint with the specified Word document loaded.

PrintOut

See Application Object.

PrintPreview

Switches the view to print preview.
Note  In addition to using the PrintPreview method, you can set the PrintPreview property to True or False to switch to or from print preview, respectively. You can also change the view by setting the Type property for the View object to wdPrintPreview.

Protect(
Type,
NoReset,
Password,
UseIRM,
EnforceStyleLock
)

Helps to protect the specified document from changes. When a document is protected, users can make only limited changes, such as adding annotations, making revisions, or completing a form.
Note  If the document is already protected when you use this method, an error occurs.
Type   Required. The protection type for the specified document. WdProtectionType.
NoReset   Optional Variant. False to reset form fields to their default values. True to retain the current form field values if the specified document is protected. If Type isn't wdAllowOnlyFormFields, the NoReset argument is ignored.
Password   Optional Variant. The password required to remove protection from the specified document. (See Remarks below.)
UseIRM    Optional Variant. Specifies whether to use Information Rights Management (IRM) when protecting the document from changes.
EnforceStyleLock    Optional Variant. Specifies whether formatting restrictions are enforced in a protected document.
Remarks
Security   Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Range(Start, End)

Returns a Range object by using the specified starting and ending character positions.
Start   Optional Variant. The starting character position.
End   Optional Variant. The ending character position.
Remarks
Character position values begin with 0 (zero) at the beginning of the document. All characters are counted, including nonprinting characters. Hidden characters are counted even if they're not displayed. If you don't specify starting and ending character positions for the Range method, the entire document is returned as a Range object.
ShapeRange objects don't include InlineShape objects. An InlineShape object is equivalent to a character and is positioned as a character within a range of text. Shape objects are anchored to a range of text (the selection, by default), but they can be positioned anywhere on the page. A Shape object will always appear on the same page as the range it's anchored to.
Most operations that you can do with a Shape object you can also do with a ShapeRange object that contains a single shape. Some operations, when performed on a ShapeRange object that contains multiple shapes, produce an error.

RecheckSmartTags

Removes smart tags recognized by the grammar checker and rechecks the document content against all smart tag recognizers.

Redo(Times)

Redoes the last action that was undone (reverses the Undo method). Returns True if the actions were redone successfully.
Times    Optional Variant. The number of actions to be redone.

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.
Note  This method reloads the document asynchronously; that is, statements following the Reload method in your procedure may execute before the document is actually reloaded. Because of this, you may get unexpected results from using this method in your macros.

ReloadAs(Encoding)

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

RemoveLockedStyles

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

RemoveNumbers

 

RemoveSmartTags

Removes all smart tag information from a document.

RemoveTheme

Removes the active theme from the current document.

Repaginate

Repaginates the entire document.

Reply

Opens a new e-mail message — with the sender's address on the To: line — for replying to the active message.

ReplyAll

Opens a new e-mail message — with the sender's and all other recipients' addresses on the To: and Cc: lines, as appropriate — for replying to the active message.

ReplyWithChanges
(ShowMessage)

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.
ShowMessage   Optional Variant. True to display the message prior to sending. False to automatically send the message without displaying it first. The default value is True.
Remarks
Use the SendForReview method to start a collaborative review of a document. If the ReplyWithChanges method is executed on a document that is not part of a collaborative review cycle, Microsoft Word displays an error message.

ResetFormFields

Clears all form fields in a document, preparing the form to be filled in again.
Remarks
Use the ResetFormFields method to clear fields when a document's fields are not locked. To clear fields when a document's fields are locked, use the Protect method.

Route

Routes the specified document, using the document's current routing slip.
Remarks
If the document doesn't have a routing slip, an error occurs. Use the HasRoutingSlip property to determine whether there's a routing slip attached to the document. Routing a document sets the Routed property to True.

RunAutoMacro(Which)

Runs an auto macro that's stored in the specified document. If the specified auto macro doesn't exist, nothing happens.
Note  Use the Run method to run any macro.
Which   Required WdAutoMacros

RunLetterWizard(
LetterContent,
WizardMode
)

Runs the Letter Wizard on the specified document.
LetterContent   Optional Variant. A LetterContent object. Any filled properties in the LetterContent object show up as prefilled elements in the Letter Wizard dialog boxes. If this argument is omitted, the GetLetterContent method is automatically used to get a LetterContent object from the specified document.
WizardMode   Optional Variant. True to display the Letter Wizard dialog box as a series of steps with a Next, Back, and Finish button. False to display the Letter Wizard dialog box as if it were opened from the Tools menu (a properties dialog box with an OK button and a Cancel button). The default value is True.
Remarks
Use the CreateLetterContent method to return a LetterContent object, given various letter element properties. Use the GetLetterContent method to return a LetterContent object based on the contents of the specified document. You can use the resulting LetterContent object with the RunLetterWizard method to preset elements in the Letter Wizard dialog box.

Save

Saves the specified document or template. If the document or template hasn't been saved before, the Save As dialog box prompts the user for a file name.

SaveAs
(FileName,
FileFormat,
LockComments,
Password,
AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter,
Encoding,
InsertLineBreaks, AllowSubstitutions,
LineEnding,
AddBiDiMarks
)

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 menu).
FileName    Optional Variant. The name for the document. The default is the current folder and file name. If the document has never been saved, the default name is used (for example, Doc1.doc). If a document with the specified file name already exists, the document is overwritten without the user being prompted first.
FileFormat    Optional Variant. The format in which the document is saved. Can be any WdSaveFormat constant. To save a document in another format, specify the appropriate value for the SaveFormat property of the FileConverter object.
LockComments    Optional Variant. True to lock the document for comments. The default is False.
Password    Optional Variant. A password string for opening the document. (See Remarks below.)
AddToRecentFiles    Optional Variant. True to add the document to the list of recently used files on the File menu. The default is True.
WritePassword    Optional Variant. A password string for saving changes to the document. (See Remarks below.)
ReadOnlyRecommended    Optional Variant. True to have Microsoft Word suggest read-only status whenever the document is opened. The default is False.
EmbedTrueTypeFonts    Optional Variant. True to save TrueType fonts with the document. If omitted, the EmbedTrueTypeFonts argument assumes the value of the EmbedTrueTypeFonts property.
SaveNativePictureFormat    Optional Variant. If graphics were imported from another platform (for example, Macintosh), True to save only the Windows version of the imported graphics.
SaveFormsData    Optional Variant. True to save the data entered by a user in a form as a data record.
SaveAsAOCELetter    Optional Variant. If the document has an attached mailer, True to save the document as an AOCE letter (the mailer is saved).
Encoding   Optional MsoEncoding . The code page, or character set, to use for documents saved as encoded text files. The default is the system code page.
InsertLineBreaks   Optional Variant. If the document is saved as a text file, True to insert line breaks at the end of each line of text.
AllowSubstitutions   Optional Variant. If the document is saved as a text file, True allows Word to replace some symbols with text that looks similar. For example, displaying the copyright symbol as (c). The default is False.
LineEnding   Optional Variant. The way Word marks the line and paragraph breaks in documents saved as text files. Can be any WdLineEndingType constant.
AddBiDiMarks   Optional Variant. True adds control characters to the output file to preserve bi-directional layout of the text in the original document.
Remarks
Security   Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Select

Selects the specified object.
Note  After using this method, use the Selection property to work with the selected items.

SelectAllEditableRanges

(EditorID)

Selects all ranges for which the specified user or group of users has permission to modify.
EditorID    Optional Variant. Can be either a String that represents the user's e-mail alias (if in the same domain), an e-mail address, or a WdEditorType constant that represents a group of users. If omitted, only ranges for which all users have permissions will be selected.

SelectNodes

(XPath, PrefixMapping, FastSearchSkippingTextNodes)

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.
XPath    Required String A valid XPath String For more information on XPath, see the XPath reference documentation on the Microsoft Developer Network (MSDN) Web site.
PrefixMapping    Optional Variant. Provides the prefix in the schema against which to perform the search. Use the PrefixMapping parameter if your XPath parameter uses names to search for elements.
FastSearchSkippingTextNodes    Optional Boolean True skips all text nodes while searching for the specified node. False includes text nodes in the search. Default value is False.
Remarks
Setting the FastSearchSkippingTextNodes parameter to True diminishes performance, because Microsoft Word searches all nodes in a document against the text contained in the node.

SelectSingleNode

(XPath, PrefixMapping, FastSearchSkippingTextNodes)

Returns an XMLNode object that represents the first node that matches the XPath parameter in the specified document.
XPath    Required String A valid XPath String For more information on XPath, see the XPath reference documentation on the Microsoft Developer Network (MSDN) Web site.
PrefixMapping    Optional Variant. Provides the prefix in the schema against which to perform the search. Use the PrefixMapping parameter if your XPath parameter uses names to search for elements.
FastSearchSkippingTextNodes     Optional Boolean True skips all text nodes while searching for the specified node. False includes text nodes in the search. Default value is True.
Remarks
Setting the FastSearchSkippingTextNodes parameter to False diminishes performance because Microsoft Word searches all nodes in a document against the text contained in the node.

SendFax

(Address, Subject)

Sends the specified document as a fax, without any user interaction.
Address   Required String The recipient's fax number.
Subject   Optional Variant. The text for the subject line. The character limit is 255.

SendFaxOverInternet

(Recipients, Subject, ShowMessage)

Sends a document to a fax service provider, who faxes the document to one or more specfied recipients.
Recipients    Optional Variant. A String that represents the fax numbers and e-mail addresses of the people to whom to send the fax. Separate multiple recipients with a semicolon.
Subject    Optional Variant. A String that represents the subject line for the faxed document.
ShowMessage    Optional Variant. True displays the fax message before sending it. False sends the fax without displaying the fax message.
Remarks
Using the SendFaxOverInternet method requires that a fax service is enabled on a user's computer. If a fax service is not enabled, the SendFaxOverInternet method will cause a runtime error.

The format used for specifying fax numbers in the Recipients parameter is either recipientsfaxnumber@usersfaxprovider or recipientsname@recipientsfaxnumber. You can access the user's fax provider information using the following registry path:

HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Services\Fax

Use the FaxAddress key value at this registry location to determine the format to use for a user. If this registry entry does not exist, no fax service is available.

SendForReview

(Recipients, Subject, ShowMessage, IncludeAttachment)

Sends a document in an e-mail message for review by the specified recipients.
Recipients   Optional Variant. A string that lists the people to whom to send the message. These can be unresolved names and aliases in an e-mail phone book or full e-mail addresses. Separate multiple recipients with a semicolon (;). If left blank and ShowMessage is False, you will receive an error message and the message will not be sent.
Subject   Optional Variant. A string for the subject of the message. If left blank, the subject will be: Please review "filename".
ShowMessage   Optional Variant. A Boolean value that indicates whether the message should be displayed when the method is executed. The default value is True. If set to False, the message is automatically sent to the recipients without first showing the message to the sender.
IncludeAttachment   Optional Variant. A Boolean value that indicates whether the message should include an attachment or a link to a server location. The default value is True. If set to False, the document must be stored at a shared location.
Remarks
The SendForReview method starts a collaborative review cycle. Use the EndReview method to end a review cycle.

SendMail

Opens a message window for sending the specified document through Microsoft Exchange.
Note  Use the SendMailAttach property to control whether the document is sent as text in the message window or as an attachment.

SetDefaultTableStyle

(Style, SetInTemplate)

Specifies the table style to use for newly created tables in a document.
Style   Required Variant. A string specifying the name of the style.
SetInTemplate   Required Boolean True to save the table style in the template attached to the document.

SetLetterContent

(LetterContent)

Inserts the contents of the specified LetterContent object into a document.
LetterContent    Required LetterContent object. The LetterContent object that includes the various elements of the letter.
Remarks
This method is similar to the RunLetterWizard method except that it doesn't display the Letter Wizard dialog box. The method adds, deletes, or restyles letter elements in the specified document based on the contents of the LetterContent object.

SetPassword EncryptionOptions

(PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties)

Sets the options Microsoft Word uses for encrypting documents with passwords.
PasswordEncryptionProvider   Required String The name of the encryption provider.
PasswordEncryptionAlgorithm   Required String The name of the encryption algorithm. Word supports stream-encrypted algorithms.
PasswordEncryptionKeyLength   Required Long The encryption key length. Must be a multiple of 8, starting at 40.
PasswordEncryptionFileProperties   Optional Variant. True for Word to encrypt file properties. Default is True.
Remarks
For enhanced security, do not use Weak Encryption (XOR) (also called "OfficeXor") or "Office97/2000 Compatible" (also called "OfficeStandard") algorithms.

ToggleFormsDesign

Toggles form design mode on or off. When Word is in form design mode, the Control Toolbox toolbar is displayed. You can use this toolbar to insert ActiveX controls such as command buttons, scroll bars, and option buttons. In form design mode, event procedures don't run, and when you click an embedded control, the control's sizing handles appear.

TransformDocument(
Path,
DataOnly
)

Applies the specified Extensible Stylesheet Language Transformation (XSLT) file to the specified document and replaces the document with the results.
Path    Required String The path for the XSLT to use.
DataOnly    Optional Boolean True applies the transformation only to the data in the document, excluding Microsoft Word XML. False applies the transform to the entire document, including Word XML. Default value is True.

Undo(Times)

Undoes the last action or a sequence of actions, which are displayed in the Undo list. Returns True if the actions were successfully undone.
Times    Optional Variant. The number of actions to be undone.

UndoClear

Clears the list of actions that can be undone for the specified document. Corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar.
Note  Include this method at the end of a macro to keep Visual Basic actions from appearing in the Undo box (for example, "VBA-Selection.InsertAfter").

UnProtect(Password)

Removes protection from the specified document. If the document isn't protected, this method generates an error.
Password    Optional Variant. The password string used to protect the document. Passwords are case-sensitive. If the document is protected with a password and the correct password isn't supplied, a dialog box prompts the user for the password.
Remarks
Security   Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

 UpdateStyles

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

UpdateSummaryProperties

Updates the keyword and comment text in the Properties dialog box (File menu) to reflect the AutoSummary content for the specified document.

ViewCode

Displays the code window for the selected ActiveX control in the specified document.
Note  This method is available only from outside of Word.

ViewPropertyBrowser

Displays the property window for the selected ActiveX control in the specified document.
Note  This method is available only from outside of Word.

WebPagePreview

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

Document Object Events

The following table lists Document object events.

Event

Description

Close

Occurs when a document is closed.

Private Sub Document_Close()

Remarks
If the event procedure is stored in a template, the procedure will run when a new document based on that template is closed and when the template itself is closed (after being opened as a document).

New

Occurs when a new document based on the template is created. A procedure for the New event will run only if it is stored in a template.

Private Sub Document_New()

Open

Occurs when a document is opened.

Private Sub Document_Open()

Remarks
If the event procedure is stored in a template, the procedure will run when a new document based on that template is opened and when the template itself is opened as a document.

Sync

Occurs when the local copy of a document that is part of a Document Workspace is synchronized with the copy on the server.

Private Sub object_Sync(SyncEventType)

object An object of type Document declared using the WithEvents keyword in a class module. For information about using events with the Document object, see Using Events with the Document Object.

SyncEventType    MsoSyncEventType. The status of the document synchronization.

MsoSyncEventType can be one of the following msoSyncEventType constants:

XMLAfterInsert

Occurs when a user adds a new XML element to a document. If more than one element is added to the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is inserted.

Private Sub object_XMLAfterInsert(NewXMLNode, InUndoRedo)

object An object of type Document that has been declared by using the WithEvents keyword in a class module. For information about using events with a Document object, see Using Events with the Document Object.

NewXMLNode XMLNode. The newly added XML node.

InUndoRedo Boolean True indicates the action was performed using the Undo or Redo feature in Microsoft Word.

Remarks
If the InUndoRedo parameter is True, never change the XML in a document while the XMLAfterInsert and XMLBeforeDelete events are running.

If the InUndoRedo parameter is False, you can insert and delete the XML in the document, but be careful that the XMLAfterInsert and XMLBeforeDelete events will not try to cancel each other out, causing an infinite loop. You can prevent infinite loops by using a global Boolean variable and check for that at the beginning of the error handler, as shown in the following example.

XMLBeforeDelete

Occurs when a user deletes an XML element from a document. If more than one element is deleted from the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is deleted.

Private Sub object_XMLBeforeDelete(DeletedRange, OldXMLNode, InUndoRedo)

object. An object of type Document that has been declared by using the WithEvents keyword in a class module. For information about using events with a Document object, see Using Events with the Document Object.

expression Required. An expression that returns a Document object.

DeletedRange    Range object. The contents of the XML element being deleted. If only an element is deleted and not associated text, the DeletedRange parameter will not exist and will, therefore, be set to Nothing.

OldXMLNode    XMLNode object. The node that is being deleted.

InUndoRedo    Boolean True indicates the action was performed using the Undo or Redo feature in Microsoft Word.

Remarks
If the InUndoRedo parameter is True, never change the XML in a document while the XMLAfterInsert and XMLBeforeDelete events are running.

If the InUndoRedo parameter is False, you can insert and delete the XML in the document—but be careful that the XMLAfterInsert and XMLBeforeDelete events will not try to cancel each other out, causing an infinite loop. You can prevent infinite loops by using a global Boolean variable and check for that at the beginning of the error handler, as shown in the following example.

Using Events with the Document Object

The Document object supports several events that enable you to respond to the state of a document. You write procedures to respond to these events in the class module named "ThisDocument." Use the following steps to create an event procedure.

Under your Normal project or document project in the Project Explorer window, double-click ThisDocument. (In Folder view, ThisDocument is located in the Microsoft Word Objects folder.)

Select Document from the Object drop-down list box.
An empty subroutine for the New event is added to the class module.
Select an event from the Procedure drop-down list box.
An empty subroutine for the selected event is added to the class module.
Add the Visual Basic instructions you want to run when the event occurs.

The following example shows a New event procedure in the Normal project that will run when a new document based on the Normal template is created.

Private Sub Document_New()
    MsgBox "New document was created"
End Sub

The following example shows a Close event procedure in a document project that runs only when that document is closed.

Private Sub Document_Close()
    MsgBox "Closing the document"
End Sub

Unlike auto macros, event procedures in the Normal template don't have a global scope. For example, event procedures in the Normal template only occur if the attached template is the Normal template.

If an auto macro exists in a document and the attached template, only the auto macro stored in the document will execute. If an event procedure for a document event exists in a document and its attached template, both event procedures will run.

Remarks
For information on creating event procedures for the Application object, see Using Events with the Application Object.

Enumerations and Constants

Enumeration WdCompatibility

Constant

Value

Constant

Value

wdAlignTablesRowByRow

39

wdNoSpaceForUL

21

wdApplyBreakingRules

46

wdNoSpaceRaiseLower

2

wdAutospaceLikeWW7

38

wdNoTabHangIndent

1

wdConvMailMergeEsc

6

wdOrigWordTableRules

9

wdDontAdjustLineHeightInTable

36

wdPrintBodyTextBeforeHeader

19

wdDontBalanceSingleByteDoubleByteWidth

16

wdPrintColBlack

3

wdDontBreakWrappedTables

43

wdSelectFieldWithFirstOrLastCharacter

45

wdDontSnapTextToGridInTableWithObjects

44

wdShapeLayoutLikeWW8

33

wdDontULTrailSpace

15

wdShowBreaksInFrames

11

wdDontUseAsianBreakRulesInGrid

48

wdSpacingInWholePoints

18

wdDontUseHTMLParagraphAutoSpacing

35

wdSubFontBySize

25

wdDontWrapTextWithPunctuation

47

wdSuppressBottomSpacing

29

wdExactOnTop

28

wdSuppressSpBfAfterPgBrk

7

wdExpandShiftReturn

14

wdSuppressTopSpacing

8

wdFootnoteLayoutLikeWW8

34

wdSuppressTopSpacingMac5

17

wdForgetLastTabAlignment

37

wdSwapBordersFacingPages

12

wdGrowAutofit

50

wdTransparentMetafiles

10

wdLayoutRawTableWidth

40

wdTruncateFontHeight

24

wdLayoutTableRowsApart

41

wdUsePrinterMetrics

26

wdLeaveBackslashAlone

13

wdUseWord2002TableStyleRules

49

wdLineWrapLikeWord6

32

wdUseWord97LineBreakingRules

42

wdMWSmallCaps

22

wdWPJustification

31

wdNoColumnBalance

5

wdWPSpaceWidth

30

wdNoExtraLineSpacing

23

wdWrapTrailSpaces

4

wdNoLeading

20

wdWW6BorderRules

27

Enumeration WdDisableFeaturesIntroducedAfter

Constant

Value

Description

wd70

0

Specifies Word for Windows 95, versions 7.0 and 7.0a.

wd70FE

1

Specifies Word for Windows 95, versions 7.0 and 7.0a, Asian edition.

wd80

2

Specifies Word 97 for Windows. Default.

Enumeration WdFarEastLineBreakLanguageID

Constant

Value

wdLineBreakJapanese

1041

wdLineBreakKorean

1042

wdLineBreakSimplifiedChinese

2052

wdLineBreakTraditionalChinese

1028

Enumeration WdShowFilter

Constant

Value

wdShowFilterFormattingAvailable

4

wdShowFilterFormattingInUse

3

wdShowFilterStylesAll

2

wdShowFilterStylesAvailable

0

wdShowFilterStylesInUse

1

Enumeration WdJustificationMode

Constant

Value

wdJustificationModeCompress

1

wdJustificationModeCompressKana

2

wdJustificationModeExpand

0

Enumeration WdDocumentKind

Constant

Value

wdDocumentEmail

2

wdDocumentLetter

1

wdDocumentNotSpecified

0

Enumeration WdFieldKind

Constant

Value

Description

wdFieldKindCold

3

A field that doesn't have a result, for example, an Index Entry (XE), Table of Contents Entry (TC), or Private field.

wdFieldKindHot

1

A field that's automatically updated each time it's displayed or each time the page is reformatted, but which can also be manually updated (for example, INCLUDEPICTURE or FORMDROPDOWN).

wdFieldKindNone

0

An invalid field (for example, a pair of field characters with nothing inside).

wdFieldKindWarm

2

A field that can be updated and has a result. This type includes fields that are automatically updated when the source changes as well as fields that can be manually updated (for example, DATE or INCLUDETEXT).

Enumeration MsoEncoding

Constant

Value

msoEncodingArabic

1256

msoEncodingArabicASMO

708

msoEncodingArabicAutoDetect

51256

msoEncodingArabicTransparentASMO

720

msoEncodingAutoDetect

50001

msoEncodingBaltic

1257

msoEncodingCentralEuropean

1250

msoEncodingCyrillic

1251

msoEncodingCyrillicAutoDetect

51251

msoEncodingEBCDICArabic

20420

msoEncodingEBCDICDenmarkNorway

20277

msoEncodingEBCDICFinlandSweden

20278

msoEncodingEBCDICFrance

20297

msoEncodingEBCDICGermany

20273

msoEncodingEBCDICGreek

20423

msoEncodingEBCDICGreekModern

875

msoEncodingEBCDICHebrew

20424

msoEncodingEBCDICIcelandic

20871

msoEncodingEBCDICInternational

500

msoEncodingEBCDICItaly

20280

msoEncodingEBCDICJapaneseKatakanaExtended

20290

msoEncodingEBCDICJapaneseKatakanaExtendedAndJapanese

50930

msoEncodingEBCDICJapaneseLatinExtendedAndJapanese

50939

msoEncodingEBCDICKoreanExtended

20833

msoEncodingEBCDICKoreanExtendedAndKorean

50933

msoEncodingEBCDICLatinAmericaSpain

20284

msoEncodingEBCDICMultilingualROECELatin2

870

msoEncodingEBCDICRussian

20880

msoEncodingEBCDICSerbianBulgarian

21025

msoEncodingEBCDICSimplifiedChineseExtendedAndSimplifiedChinese

50935

msoEncodingEBCDICThai

20838

msoEncodingEBCDICTurkish

20905

msoEncodingEBCDICTurkishLatin5

1026

msoEncodingEBCDICUnitedKingdom

20285

msoEncodingEBCDICUSCanada

37

msoEncodingEBCDICUSCanadaAndJapanese

50931

msoEncodingEBCDICUSCanadaAndTraditionalChinese

50937

msoEncodingEUCChineseSimplifiedChinese

51936

msoEncodingEUCJapanese

51932

msoEncodingEUCKorean

51949

msoEncodingEUCTaiwaneseTraditionalChinese

51950

msoEncodingEuropa3

29001

msoEncodingExtAlphaLowercase

21027

msoEncodingGreek

1253

msoEncodingGreekAutoDetect

51253

msoEncodingHebrew

1255

msoEncodingHZGBSimplifiedChinese

52936

msoEncodingIA5German

20106

msoEncodingIA5IRV

20105

msoEncodingIA5Norwegian

20108

msoEncodingIA5Swedish

20107

msoEncodingISCIIAssamese

57006

msoEncodingISCIIBengali

57003

msoEncodingISCIIDevanagari

57002

msoEncodingISCIIGujarati

57010

msoEncodingISCIIKannada

57008

msoEncodingISCIIMalayalam

57009

msoEncodingISCIIOriya

57007

msoEncodingISCIIPunjabi

57011

msoEncodingISCIITamil

57004

msoEncodingISCIITelugu

57005

msoEncodingISO2022CNSimplifiedChinese

50229

msoEncodingISO2022CNTraditionalChinese

50227

msoEncodingISO2022JPJISX02011989

50222

msoEncodingISO2022JPJISX02021984

50221

msoEncodingISO2022JPNoHalfwidthKatakana

50220

msoEncodingISO2022KR

50225

msoEncodingISO6937NonSpacingAccent

20269

msoEncodingISO885915Latin9

28605

msoEncodingISO88591Latin1

28591

msoEncodingISO88592CentralEurope

28592

msoEncodingISO88593Latin3

28593

msoEncodingISO88594Baltic

28594

msoEncodingISO88595Cyrillic

28595

msoEncodingISO88596Arabic

28596

msoEncodingISO88597Greek

28597

msoEncodingISO88598Hebrew

28598

msoEncodingISO88599Turkish

28599

msoEncodingJapaneseAutoDetect

50932

msoEncodingJapaneseShiftJIS

932

msoEncodingKOI8R

20866

msoEncodingKOI8U

21866

msoEncodingKorean

949

msoEncodingKoreanAutoDetect

50949

msoEncodingKoreanJohab

1361

msoEncodingMacArabic

10004

msoEncodingMacCroatia

10082

msoEncodingMacCyrillic

10007

msoEncodingMacGreek1

10006

msoEncodingMacHebrew

10005

msoEncodingMacIcelandic

10079

msoEncodingMacJapanese

10001

msoEncodingMacKorean

10003

msoEncodingMacLatin2

10029

msoEncodingMacRoman

10000

msoEncodingMacRomania

10010

msoEncodingMacSimplifiedChineseGB2312

10008

msoEncodingMacTraditionalChineseBig5

10002

msoEncodingMacTurkish

10081

msoEncodingMacUkraine

10017

msoEncodingOEMArabic

864

msoEncodingOEMBaltic

775

msoEncodingOEMCanadianFrench

863

msoEncodingOEMCyrillic

855

msoEncodingOEMCyrillicII

866

msoEncodingOEMGreek437G

737

msoEncodingOEMHebrew

862

msoEncodingOEMIcelandic

861

msoEncodingOEMModernGreek

869

msoEncodingOEMMultilingualLatinI

850

msoEncodingOEMMultilingualLatinII

852

msoEncodingOEMNordic

865

msoEncodingOEMPortuguese

860

msoEncodingOEMTurkish

857

msoEncodingOEMUnitedStates

437

msoEncodingSimplifiedChineseAutoDetect

50936

msoEncodingSimplifiedChineseGBK

936

msoEncodingT61

20261

msoEncodingTaiwanCNS

20000

msoEncodingTaiwanEten

20002

msoEncodingTaiwanIBM5550

20003

msoEncodingTaiwanTCA

20001

msoEncodingTaiwanTeleText

20004

msoEncodingTaiwanWang

20005

msoEncodingThai

874

msoEncodingTraditionalChineseAutoDetect

50950

msoEncodingTraditionalChineseBig5

950

msoEncodingTurkish

1254

msoEncodingUnicodeBigEndian

1201

msoEncodingUnicodeLittleEndian

1200

msoEncodingUSASCII

20127

msoEncodingUTF7

65000

msoEncodingUTF8

65001

msoEncodingVietnamese

1258

msoEncodingWestern

1252

Enumeration WdSaveFormat

Constant

Value

Description

wdFormatDocument

0

Saves as a Microsoft Word document. Default.

wdFormatDOSText

4

Saves text without formatting. Converts all section breaks, page breaks, and new line characters to paragraph marks. Uses the ANSI character set. Use this format to share documents between Word and DOS-based programs.

wdFormatDOSTextLineBreaks

5

Saves text without formatting. Converts all line breaks, section breaks, and page breaks to paragraph marks. Use this format when you want to maintain line breaks, for example, when transferring documents to an electronic mail system.

wdFormatEncodedText

7

Saves as an encoded text file. Use the Encoding argument to specify the code page to use.

wdFormatFilteredHTML

10

Saves text with HTML tags with minimal cascading style sheet formatting. The resulting document can be viewed in a Web browser.

wdFormatHTML

8

Saves all text and formatting with HTML tags so that the resulting document can be viewed in a Web browser.

wdFormatRTF

6

Saves all formatting. Converts formatting to instructions that other programs, including compatible Microsoft programs, can read and interpret.

wdFormatTemplate

1

Saves as a Word template.

wdFormatText

2

Saves text without formatting. Converts all section breaks, page breaks, and new line characters to paragraph marks. Uses the ANSI character set. Use this format if the destination program cannot read any of the other available file formats.

wdFormatTextLineBreaks

3

Saves text without formatting. Converts all line breaks, section breaks, and page breaks to paragraph marks. Use this format when you want to maintain line breaks, for example, when transferring documents to an electronic mail system.

wdFormatUnicodeText

7

Saves as a Unicode text file. Converts text between common character encoding standards, including Unicode 2.0, Mac OS, Windows, EUC and ISO-8859 series.

wdFormatWebArchive

9

Saves the text, images, and formatting as a single-file Web page.

wdFormatXML

11

Saves text and formatting using Extensible Markup Language (XML) and the Word XML schema.

Enumeration WdSummaryMode

Constant

Value

Description

wdSummaryModeCreateNew

3

Creates a new document and inserts the specified summary.

wdSummaryModeHideAllButSummary

1

Hides everything except the specified summary and displays the AutoSummarize toolbar.

wdSummaryModeHighlight

0

Highlights the key points in the specified document and displays the AutoSummarize toolbar.

wdSummaryModeInsert

2

Inserts a summary at the beginning of the specified document.

Enumeration WdLineEndingType

Constant

Value

wdCRLF

0

wdCROnly

1

wdLFCR

3

wdLFOnly

2

wdLSPS

4

Enumeration WdDocumentType

Constant

Value

wdTypeDocument

0

wdTypeFrameset

2

wdTypeTemplate

1

Enumeration WdCompareTarget

Constant

Value

Description

wdCompareTargetCurrent

1

Places comparison differences in the current document. Default.

wdCompareTargetNew

2

Places comparison differences in a new document.

wdCompareTargetSelected

0

Places comparison differences in the target document.

Enumeration WdStatistic

Constant

Value

wdStatisticCharacters

3

wdStatisticCharactersWithSpaces

5

wdStatisticFarEastCharacters

6

wdStatisticLines

1

wdStatisticPages

2

wdStatisticParagraphs

4

wdStatisticWords

0

Enumeration WdNumberType

Constant

Value

Description

wdNumberAllNumbers

3

Default value for all other cases.

wdNumberListNum

2

Default value for LISTNUM fields.

wdNumberParagraph

1

 

Enumeration WdLetterStyle

Constant

Value

wdFullBlock

0

wdModifiedBlock

1

wdSemiBlock

2

Enumeration WdLetterheadLocation

Constant

Value

wdLetterBottom

1

wdLetterLeft

2

wdLetterRight

3

wdLetterTop

0

Enumeration WdSalutationType

Constant

Value

wdSalutationBusiness

2

wdSalutationFormal

1

wdSalutationInformal

0

wdSalutationOther

3

Enumeration WdEditorType

Constant

Value

Description

wdEditorCurrent

-6

Represents the current user of the document.

wdEditorEditors

-5

Represents the Editors group for documents that use Information Rights Management.

wdEditorEveryone

-1

Represents all users who open a document.

wdEditorOwners

-4

Represents the Owners group for documents that use Information Rights Management.

Enumeration WdGoToItem

Constant

Value

wdGoToBookmark

-1

wdGoToComment

6

wdGoToEndnote

5

wdGoToEquation

10

wdGoToField

7

wdGoToFootnote

4

wdGoToGrammaticalError

14

wdGoToGraphic

8

wdGoToHeading

11

wdGoToLine

3

wdGoToObject

9

wdGoToPage

1

wdGoToPercent

12

wdGoToProofreadingError

15

wdGoToSection

0

wdGoToSpellingError

13

wdGoToTable

2

Enumeration WdGoToDirection

Constant

Value

wdGoToAbsolute

1

wdGoToFirst

1

wdGoToLast

-1

wdGoToNext

2

wdGoToPrevious

3

wdGoToRelative

2

Enumeration WdProtectionType

Constant

Value

wdAllowOnlyComments

1

wdAllowOnlyFormFields

2

wdAllowOnlyReading

3

wdAllowOnlyRevisions

0

wdNoProtection

-1

Enumeration WdAutoMacros

Constant

Value

wdAutoClose

3

wdAutoExec

0

wdAutoExit

4

wdAutoNew

1

wdAutoOpen

2

wdAutoSync

5

Enumeration MsoSyncEventType

Constant

Value

msoSyncEventDownloadFailed

2

msoSyncEventDownloadInitiated

0

msoSyncEventDownloadNoChange

6

msoSyncEventDownloadSucceeded

1

msoSyncEventOffline

7

msoSyncEventUploadFailed

5

msoSyncEventUploadInitiated

3

msoSyncEventUploadSucceeded

4

Enumeration WdMergeTarget

Constant

Value

wdMergeTargetCurrent

1

wdMergeTargetNew

2

wdMergeTargetSelected

0

Enumeration WdUseFormattingFrom

Constant

Value

wdFormattingFromCurrent

0

wdFormattingFromPrompt

2

wdFormattingFromSelected

1

Enumeration WdReferenceType

Constant Value
wdRefTypeBookmark 2
wdRefTypeEndnote 4
wdRefTypeFootnote 3
wdRefTypeHeading 1
wdRefTypeNumberedItem 0

 


Etudes for Microsoft Word Programmers. Appendix. Object Document.


Unless otherwise noted, all materials on this site are
© 2000-2009 Evgeny Akhundzhanov, All Rights Reserved Worldwide
Microsoft is in no way affiliated with, nor offers endorsement of, this site.
www.transcriber.ru | E-mail the Author