Etudes for Microsoft Word Programmers. Appendix.


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

Object Range (Word 2003)

Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position. Similar to the way bookmarks are used in a document, Range objects are used in Visual Basic procedures to identify specific portions of a document. However, unlike a bookmark, a Range object only exists while the procedure that defined it is running.

Note  Range objects are independent of the selection. That is, you can define and manipulate a range without changing the selection. You can also define multiple ranges in a document, while there can be only one selection per pane.

Using the Range Object

Use the Range method to return a Range object defined by the given starting and ending character positions. The following example returns a Range object that refers to the first 10 characters in the active document.

Set myRange = ActiveDocument.Range(Start:=0, End:=10)

Use the Range property to return a Range object defined by the beginning and end of another object. The Range property applies to many objects (for example, Paragraph, Bookmark, and Cell). The following example returns a Range object that refers to the first paragraph in the active document.

Set aRange = ActiveDocument.Paragraphs(1).Range

The following example returns a Range object that refers to the second through fourth paragraphs in the active document

Set aRange = ActiveDocument.Range( _
    Start:=ActiveDocument.Paragraphs(2).Range.Start, _
    End:=ActiveDocument.Paragraphs(4).Range.End)

Working with Range Object

A common task when using Visual Basic is to specify an area in a document and then do something with it, such as insert text or apply formatting. For example, you may want to write a macro that locates a word or phrase within a portion of a document. The portion of the document can be represented by a Range object. After the Range object is identified, methods and properties of the Range object can be applied in order to modify the contents of the range.

A Range object refers to a contiguous area in a document. Each Range object is defined by a starting and ending character position. Similar to the way bookmarks are used in a document, Range objects are used in Visual Basic procedures to identify specific portions of a document. A Range object can be as small as the insertion point or as large as the entire document. However, unlike a bookmark, a Range object only exists while the procedure that defined it is running.

The Start , End and StoryType properties uniquely identify a Range object. The Start and End properties return or set the starting and ending character positions of the Range object. The character position at the beginning of the document is zero, the position after the first character is one, and so on. There are eleven different story types represented by the WdStoryType constants of the StoryType property.

Note  Range objects are independent of the selection. That is, you can define and modify a range without changing the current selection. You can also define multiple ranges in a document, while there is only one selection per document pane.

Using the Range Method

The Range method is used to create a Range object in the specified document. The Range method (which is available from the Document object) returns a Range object located in the main story given a start and end point. The following example creates a Range object that is assigned to a variable.

Sub SetNewRange()
    Dim rngDoc As Range
    Set rngDoc = ActiveDocument.Range(Start:=0, End:=10)
End Sub

The variable refers to the first ten characters in the active document. You can see that the Range object has been created when you apply a property or method to the Range object stored in a variable. The following example applies bold formatting to the first ten characters in the active document.

Sub SetBoldRange()
    Dim rngDoc As Range
    Set rngDoc = ActiveDocument.Range(Start:=0, End:=10)
    rngDoc.Bold = True
End Sub

When you need to refer to a Range object multiple times, you can use the Set statement to set a variable equal to the Range object. However, if you only need to perform a single action on a Range object, there's no need to store the object in a variable. The same results can be achieved using just one instruction that identifies the range and changes the Bold property.

Sub BoldRange()
    ActiveDocument.Range(Start:=0, End:=10).Bold = True
End Sub

Like a bookmark, a range can span a group of characters or mark a location in a document. The Range object in the following example has the same starting and ending points. The range does not include any text. The following example inserts text at the beginning of the active document.

Sub InsertTextBeforeRange()
    Dim rngDoc As Range
    Set rngDoc = ActiveDocument.Range(Start:=0, End:=0)
    rngDoc.InsertBefore "Hello "
End Sub

You can define the beginning and end points of a range using the character position numbers as shown above, or use the Start and End properties with objects such as Selection , Bookmark , or Range. The following example creates a Range object beginning at the start of the second paragraph and ending after the third paragraph.

Sub NewRange()
    Dim doc As Document
    Dim rngDoc As Range
    Set doc = ActiveDocument
    Set rngDoc = doc.Range(Start:=doc.Paragraphs(2).Range.Start, _
        End:=doc.Paragraphs(3).Range.End)
End Sub

For additional information and examples, see the Range method.

Using a Range Property

The Range property appears on multiple objects, such as Paragraph , Bookmark , and Cell , and is used to return a Range object. The following example returns a Range object that refers to the first paragraph in the active document.

Sub SetParagraphRange()
    Dim rngParagraph As Range
    Set rngParagraph = ActiveDocument.Paragraphs(1).Range
End Sub

After you have a Range object, you can use any of its properties or methods to modify the Range object. The following example selects the second paragraph in the active document and then centers the selection.

Sub FormatRange()
    ActiveDocument.Paragraphs(2).Range.Select
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
End Sub

If you need to apply numerous properties or methods to the same Range object, you can use the With∦End With structure. The following example formats the text in the first paragraph of the active document.

Sub FormatFirstParagraph()
    Dim rngParagraph As Range
    Set rngParagraph = ActiveDocument.Paragraphs(1).Range
    With rngParagraph
        .Bold = True
        .ParagraphFormat.Alignment = wdAlignParagraphCenter
        With .Font
            .Name = "Stencil"
            .Size = 15
        End With
    End With
End Sub

For additional information and examples, see the Range property topic.

Redefining a Range object

Use the SetRange method to redefine an existing Range object. The following example defines a range as the current selection. The SetRange method then redefines the range so that it refers to current selection plus the next ten characters.

Sub ExpandRange()
    Dim rngParagraph As Range
    Set rngParagraph = Selection.Range
    rngParagraph.SetRange Start:=rngParagraph.Start, _
        End:=rngParagraph.End + 10
End Sub

For additional information and examples, see the SetRange method.

Note  When debugging your macros, you can use the Select method to ensure that a Range object is referring to the correct range of text. For example, the following example selects a Range object, which refers the second and third paragraphs in the active document, and then formats the font of the selection.

Sub SelectRange()
    Dim rngParagraph As Range
    Set rngParagraph = ActiveDocument.Paragraphs(2).Range
    rngParagraph.SetRange Start:=rngParagraph.Start, _
        End:=ActiveDocument.Paragraphs(3).Range.End
    rngParagraph.Select
    Selection.Font.Italic = True
End Sub

Range Object Properties

Range object properties are described in the following table.

Property

Type

Description

Application

Application object

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.

Bold

Read/write Long

True if the font or range is formatted as bold. Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

BoldBi

Read/write Long

True if the font or range is formatted as bold. Returns True, False or wdUndefined (for a mixture of bold and non-bold text). Can be set to True, False, or wdToggle.
Remarks
The BoldBi property applies to text in a right-to-left language.
For more information on using Word with right-to-left languages, see Word features for right-to-left languages.

BookmarkID

Read-only Long

Returns the number of the bookmark that encloses the beginning of the specified selection or range; returns 0 (zero) if there's no corresponding bookmark. The number corresponds to the position of the bookmark in the document — 1 for the first bookmark, 2 for the second one, and so on.

Bookmarks

Read-only Bookmarks collection

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

Borders

Borders collection

Returns a Borders collection that represents all the borders for the specified object.

Case

Read/write
Long

Returns or sets a WdCharacterCase constant that represents the case of the text in the specified range.
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.

Cells

Read-only Cells collection

Returns a Cells collection that represents the table cells in a column, row, selection, or range.

Characters

Read-only Characters collection

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

CharacterWidth

Read/write WdCharacterWidth

Returns or sets the character width of the specified range.

Columns

Read-only Columns collection

Returns a Columns collection that represents all the table columns in the range, selection, or table.

CombineCharacters

Read/write Boolean

True if the specified range contains combined characters.

Comments

Read-only Comments collection

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

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.

DisableCharacter SpaceGrid

Read/write Boolean

True if Microsoft Word ignores the number of characters per line for the corresponding Font or Range object. Returns wdUndefined if the DisableCharacterSpaceGrid property is set to True for only some of the specified font or range.

Document

Read-only  Document object

Returns a Document object associated with the specified pane, window, or selection.

Duplicate

read-only Range object

Returns a read-only Range object that represents all the properties of the specified range.
Remarks
You can use the Duplicate property to pick up the settings of all the properties of a duplicated Font, LetterContent, or ParagraphFormat object. You can assign the object returned by the Duplicate property to another object of the same type to apply those settings all at once. Before assigning the duplicate object to another object, you can change any of the properties of the duplicate object without affecting the original.
By duplicating a Range object, you can change the starting or ending character position of the duplicate range without changing the original range.

Editors

Editors object

Returns an Editors object that represents all the users authorized to modify a selection or range within a document.

EmphasisMark

Read/write WdEmphasisMark

Returns or sets the emphasis mark for a character or designated character string.

End

Read/write Long

Returns or sets the ending character position of a selection, range, or bookmark.
Note  If this property is set to a value smaller than the Start property, the Start property is set to the same value (that is, the Start and End property are equal).
Remarks
The Selection, Range, and Bookmark objects all have a starting position and an ending position. The ending position is the point farthest away from the beginning of the story.
This property returns the ending character position relative to the beginning of the story. The main document story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a selection, range, or bookmark by setting this property.

EndnoteOptions

EndnoteOptions object

Returns an EndnoteOptions object that represents the endnotes in a range or selection.

Endnotes

Read-only Endnotes collection

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

EnhMetaFileBits

Variant

Returns a Variant that represents a picture representation of how a selection or range of text appears.
Note  The EnhMetaFileBits property returns an array of bytes, which can be used with the Microsoft Windows 32 Application Programming Interface from within the Microsoft Visual Basic or Microsoft C++ development environment.

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.

Find

Read-only Find object

Returns a Find object that contains the criteria for a find operation.
Note  When this property is used with a Selection object, the selection is changed if the find operation is successful. If this property is used with a Range object, the selection isn't changed unless the Select method is applied.

FitTextWidth

Read/write Single

Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection or range.

Font

Read/write Font object

Returns or sets a Font object that represents the character formatting of the specified object. To set this property, specify an expression that returns a Font object.

FootnoteOptions

FootnoteOptions object

Returns FootnoteOptions object that represents the footnotes in a selection or range.

Footnotes

Read-only FootnoteOptions object

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

FormattedText

Read/write Range object

Returns or sets a Range object that includes the formatted text in the specified range or selection.
Remarks
This property returns a Range object with the character formatting and text from the specified range or selection. Paragraph formatting is included in the Range object if there's a paragraph mark in the range or selection.
When you set this property, the text in the range is replaced with formatted text. If you don't want to replace the existing text, use the Collapse method before using this property (see the first example).

FormFields

Read-only FormFields collection

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

Frames

Read-only Frames collection

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

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 ProofreadingErrors 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.
Remarks
If there are no grammatical errors, the Count property for the ProofreadingErrors object returned by the GrammaticalErrors property returns 0 (zero).

HighlightColorIndex

Read/write WdColorIndex

Returns or sets the highlight color for the specified range.
Remarks
Setting this property to wdNoHighlight removes the highlight color (if any) from the specified range.

HorizontalInVertical

Read/write WdHorizontalInVerticalType

Returns or sets the formatting for horizontal text set within vertical text.

HTMLDivisions

HTMLDivisions object

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

Hyperlinks

Read-only Hyperlinks collection

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

ID

Read/write String

Returns or sets the identifying label for the specified object when the current document is saved as a Web page. With the exception of the Editor object, you can use a label as a hyperlink reference from other Web pages or from within the current document.
Note  The Object Browser states that the ID property for the Range object is read/write. However, Microsoft Word does not store the ID property setting for a Range object. If you set the ID property and then return its value, the returned value will be an empty String.

This example sets the ID of current selection to "target". The selection will become the target of a hyperlink, defined as <A HREF="#target" TARGET="_self">History</A>, in the same document.
Selection.Range.ID = "target"

Information(Type)

 

Read-only Variant

Returns information about the specified selection or range.
Type   Required WdInformation . The information type.

InlineShapes

Read-only InlineShapes collection

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

IsEndOfRowMark

Read-only Boolean

True if the specified selection or range is collapsed and is located at the end-of-row mark in a table.
Note  This property is the equivalent of the following expression:
Selection.Information(wdAtEndOfRowMarker)

Italic

Read/write Long

True if the font or range is formatted as italic. Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

ItalicBi

Read/write Long

True if the font or range is formatted as italic. Returns True, False or wdUndefined (for a mixture of italic and non-italic text). Can be set to True, False, or wdToggle.
Remarks
The ItalicBi property applies to text in right-to-left languages. For more information on using Word with right-to-left languages, see Word features for right-to-left languages.

Kana

Read/write WdKana

Returns or sets whether the specified range of Japanese language text is hiragana or katakana.
Remarks
This property returns wdUndefined if the range contains a mix of hiragana and katakana or if the range contains some non-Japanese text. If you set the Kana property to wdUndefined, an error occurs.

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.

LanguageID

Read/write

Returns or sets the language for the specified object.
Remarks
For a custom dictionary, you must first set the LanguageSpecific property to True before specifying the the LanguageID property. Custom dictionaries that are language specific only look at text formatted for that language.
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.

LanguageIDFarEast

Read/write WdLanguageID

Returns or sets an East Asian language for the specified object.
Remarks
This is the recommended way to return or set the language of East Asian text in a document created in an East Asian version of Microsoft Word.

LanguageIDOther

Read/write WdLanguageID

Returns or sets the language for the specified object.
Remarks
This is the recommended way to return or set the language of Latin text in a document created in a right-to-left language version of Microsoft Word.

ListFormat

Read-only

Returns a ListFormat object that represents all the list formatting characteristics of a range.

ListParagraphs

Read-only

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

NextStoryRange

Range object

Returns a Range object that refers to the next story, as shown in the following table.

Story type

Item returned by the NextStoryRange method

wdMainTextStory, wdFootnotesStory, wdEndnotesStory, and wdCommentsStory

Always returns Nothing

wdTextFrameStory

The story of the next set of linked text boxes

wdEvenPagesHeaderStory, wdPrimaryHeaderStory, wdEvenPagesFooterStory, wdPrimaryFooterStory, wdFirstPageHeaderStory, wdFirstPageFooterStory

The next section's story of the same type

NoProofing

Read/write Long

True if the spelling and grammar checker ignores the specified text. Returns wdUndefined if the NoProofing property is set to True for only some of the specified text.

Orientation

Read/write WdTextOrientation

Returns or sets the orientation of text in a range or selection when the Text Direction feature is enabled.
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.
You can set the orientation for a text frame or for a range or selection that happens to occur inside a text frame. For information about the difference between a text frame and a text box, see the TextFrame object.

PageSetup

Read-only PageSetup object

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

ParagraphFormat

Read/write ParagraphFormat object

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified range, selection, find or replacement operation, or style.

Paragraphs

Read-only Paragraphs collection

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

Parent

 

Returns an object that represents the parent object of the specified object.

PreviousBookmarkID

Read-only Long

Returns the number of the last bookmark that starts before or at the same place as the specified selection or range; returns 0 (zero) if there's no corresponding bookmark.

ReadabilityStatistics

Read-only ReadabilityStatistics collection

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

Revisions

Read-only Revisions collection

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

Rows

Read-only Rows collection

Returns a Rows collection that represents all the table rows in a range, selection, or table.

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.

Shading

Shading object

Returns a Shading object that refers to the shading formatting for the specified object.

ShapeRange

Read-only ShapeRange collection

Returns a ShapeRange collection that represents all the Shape objects in the specified range or selection. The shape range can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.

ShowAll

Read/write Boolean

True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed.

SmartTags

SmartTags object

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

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 ProofreadingErrors collection

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

Start

Read/write Long

Returns or sets the starting character position of a selection, range, or bookmark.
Note  If this property is set to a value larger than that of the End property, the End property is set to the same value as that of Start property.
Remarks
Selection, Range, and Bookmark objects have starting and ending character positions. The starting position refers to the character position closest to the beginning of the story.
This property returns the starting character position relative to the beginning of the story. The main text story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a selection, range, or bookmark by setting this property.

StoryLength

Read-only Long

Returns the number of characters in the story that contains the specified range or selection.

StoryType

Read-only WdStoryType

Returns the story type for the specified range, selection, or bookmark.

Style

Read/write Variant

Returns or sets the style for the specified object. To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. For a list of valid constants, consult the Microsoft Visual Basic Object Browser.
Remarks
When you return the style for a range that includes more than one style, only the first character or paragraph style is returned.

Subdocuments

Read-only Subdocuments collection

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

SynonymInfo

SynonymInfo object

Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.

Tables

Read-only Tables collection

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

Text

Read/write String

Returns or sets the text in the specified range or selection.
Remarks
The Text property returns the plain, unformatted text of the selection or range. When you set this property, the text of the range or selection is replaced.

TextRetrievalMode

Read/write  extRetrievalMode object

Returns a TextRetrievalMode object that controls how text is retrieved from the specified Range.

TopLevelTables

Read-only Tables collection

Returns a Tables collection that represents the tables at the outermost nesting level in the current range or selection.
Remarks
This method returns a collection containing only those tables at the outermost nesting level within the context of the current range or selection. These tables may not be at the outermost nesting level within the entire set of nested tables.

TwoLinesInOne

Read/write WdTwoLinesInOneType

Returns or sets whether Microsoft Word sets two lines of text in one and specifies the characters that enclose the text, if any.
Remarks
Setting the TwoLinesInOne property to wdTwoLinesInOneNoBrackets sets two lines of text in one without enclosing the text in any characters. Setting the TwoLinesInOne property to wdTwoLinesInOneNone restores a line of combined text to two separate lines.

Underline

Read/write WdUnderline

Returns or sets the type of underline applied to the font or range.

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.

XML

String

Returns a String that represents the XML text in the specified object.
DataOnly   Optional Boolean. True returns the text of the XML without the Word XML markup. The default setting is False.

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.

XMLParentNode

XMLNode object

Returns an XMLNode object that represents the parent node of a selection or range.

Range Object Methods

Range object methods are described in the following table.

Method

Description

AutoFormat

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

Calculate

Calculates a mathematical expression within a range or selection. Returns the result as a Single.

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).

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).
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.

CheckSynonyms

Displays the Thesaurus dialog box, which lists alternative word choices, or synonyms, for the text in the specified range.

Collapse(Direction)

Collapses a range or selection to the starting or ending position. After a range or selection is collapsed, the starting and ending points are equal.
Direction    Optional Variant. The direction in which to collapse the range or selection. Can be either of the following WdCollapseDirection constants: wdCollapseEnd or wdCollapseStart. The default value is wdCollapseStart.
Remarks
If you use wdCollapseEnd to collapse a range that refers to an entire paragraph, the range is located after the ending paragraph mark (the beginning of the next paragraph). However, you can move the range back one character by using the MoveEnd method after the range is collapsed, as shown in the following example.

ComputeStatistics(
Statistic
)

Returns a statistic based on the contents of the specified range. Long.
Statistic   Required WdStatistic .
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.

ConvertHangul AndHanja(
ConversionsMode, FastConversion, CheckHangulEnding, EnableRecentOrdering, CustomDictionary)

Converts the specified range from hangul to hanja or vice versa.
ConversionsMode   Optional Variant. Sets the direction for the conversion between hangul and hanja. Can be either of the following WdMultipleWordConversionsMode constants: wdHangulToHanja or wdHanjaToHangul. The default value is the current value of the MultipleWordConversionsMode property.
FastConversion   Optional Variant. True if Microsoft Word automatically converts a word with only one suggestion for conversion. The default value is the current value of the HangulHanjaFastConversion property.
CheckHangulEnding   Optional Variant. True if Word automatically detects hangul endings and ignores them. The default value is the current value of the CheckHangulEndings property. This argument is ignored if the ConversionsMode argument is set to wdHanjaToHangul.
EnableRecentOrdering   Optional Variant. True if Word displays the most recently used words at the top of the suggestions list. The default value is the current value of the EnableHangulHanjaRecentOrdering property.
CustomDictionary   Optional Variant. The name of a custom hangul-hanja conversion dictionary. Use this argument in order to use a custom dictionary with hangul-hanja conversions not contained in the main dictionary.

ConvertToTable(
Separator,
NumRows, NumColumns, InitialColumnWidth, Format,
ApplyBorders, ApplyShading, ApplyFont,
ApplyColor, ApplyHeadingRows, ApplyLastRow, ApplyFirstColumn, ApplyLastColumn, AutoFit, AutoFitBehavior, DefaultTableBehavior
)

Converts text within a range or selection to a table. Returns the table as a Table object.
Separator    Optional Variant. Specifies the character used to separate text into cells. Can be a character or one of the following WdTableFieldSeparator constant. If this argument is omitted, the value of the DefaultTableSeparator property is used.
NumRows    Optional Variant. The number of rows in the table. If this argument is omitted, Microsoft Word sets the number of rows, based on the contents of the range or selection.
NumColumns    Optional Variant. The number of columns in the table. If this argument is omitted, Word sets the number of columns, based on the contents of the range or selection.
InitialColumnWidth    Optional Variant. The initial width of each column, in points. If this argument is omitted, Word calculates and adjusts the column width so that the table stretches from margin to margin.
Format    Optional Variant. Specifies one of the predefined formats listed in the Table AutoFormat dialog box (Table menu). Can be one of the WdTableFormat constants.
ApplyBorders    Optional Variant. True to apply the border properties of the specified format.
ApplyShading    Optional Variant. True to apply the shading properties of the specified format.
ApplyFont    Optional Variant. True to apply the font properties of the specified format.
ApplyColor    Optional Variant. True to apply the color properties of the specified format.
ApplyHeadingRows    Optional Variant. True to apply the heading-row properties of the specified format.
ApplyLastRow    Optional Variant. True to apply the last-row properties of the specified format.
ApplyFirstColumn    Optional Variant. True to apply the first-column properties of the specified format.
ApplyLastColumn    Optional Variant. True to apply the last-column properties of the specified format.
AutoFit    Optional Variant. True to decrease the width of the table columns as much as possible without changing the way text wraps in the cells.
AutoFitBehavior    Optional Variant. Sets the AutoFit rules for how Word sizes a table. Can be one of the following WdAutoFitBehavior constant. If DefaultTableBehavior is wdWord8TableBehavior, this argument is ignored.
DefaultTableBehavior    Optional Variant. Sets a value that specifies whether Microsoft Word automatically resizes cells in a table to fit the contents (AutoFit). Can be one of the following WdDefaultTableBehavior constant.

Copy

Copies the specified object to the Clipboard.

CopyAsPicture

The CopyAsPicture method works the same way as the Copy method for Range and Selection objects.

Cut

Removes the specified object from the document and places it on the Clipboard.
Remarks
If expression returns a Range or Selection object, the contents of the object are cut to the Clipboard but the collapsed object remains in the document.

Delete(Unit,Count)

Deletes the specified number of characters or words. This method returns a Long value that indicates the number of items deleted, or it returns 0 (zero) if the deletion was unsuccessful.
Unit  Optional Variant. The unit by which the collapsed range or selection is to be deleted. Can be one of the following WdUnits constants: wdCharacter (default) or wdWord.
Count  Optional Variant. The number of units to be deleted. To delete units after the range or selection, collapse the range or selection and use a positive number. To delete units before the range or selection, collapse the range or selection and use a negative number.

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.

EndOf(Unit, Extend)

Moves or extends the ending character position of a range or selection to the end of the nearest specified text unit. This method returns a value that indicates the number of character positions the range or selection was moved or extended (movement is forward in the document).
Unit   Optional Variant. The unit by which to move the ending character position. WdUnits .
If expression returns a Selection object, wdLine can also be used. The default value is wdWord.
Extend   Optional Variant.WdMovementType (wdMove or wdExtend).
If wdMove, both ends of the range or selection object are moved to the end of the specified unit. If wdExtend is used, the end of the range or selection is extended to the end of the specified unit. The default value is wdMove.
Remarks
If the both the starting and ending positions for the range or selection are already at the end of the specified unit, this method doesn't move or extend the range or selection. For example, if the selection is at the end of a word and the trailing space, the following instruction doesn't change the selection (char equals 0 (zero)).
char = Selection.EndOf(Unit:=wdWord, Extend:=wdMove)

Expand(Unit)

Expands the specified range or selection. Returns the number of characters added to the range or selection. Long
Unit   Optional Variant. The unit by which to expand the range. WdUnits.

GetSpelling Suggestions(
CustomDictionary, IgnoreUppercase, MainDictionary, SuggestionMode, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for the first word in the specified range.
CustomDictionary  Optional Variant. Either an expression that returns a Dictionary object or the file name of the custom dictionary.
IgnoreUppercase  Optional Variant. True to ignore words in all uppercase letters. If this argument is omitted, the current value of the IgnoreUppercase property is used.
MainDictionary  Optional Variant. Either an expression that returns a Dictionary object or the file name of the main dictionary. If you don't specify a main dictionary, Microsoft Word uses the main dictionary that corresponds to the language formatting of the first word in the range.
SuggestionMode  Optional Variant. Specifies the way Word makes spelling suggestions. Can be one of the following WdSpellingWordType constants. The default value is WdSpellword.
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.
Remarks
If the word is spelled correctly, the Count property of the SpellingSuggestions object returns 0 (zero).

GoTo(
What,
Which,
Count,
Name
)

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.
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToFirst
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToAbsolute, Count:=1

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.
Selection.GoTo What:=wdGoToLine, Which:=wdGoToAbsolute, Count:=4

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.
Selection.GoTo What:=wdGoToLine, Which:=wdGoToPrevious, Count:=2

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.
Selection.GoTo What:=wdGoToField, Name:="Date"

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.

GoToEditableRange(
EditorID
)

Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.
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, selects all ranges for which all users have permissions to edit.
wdEditorType can be one of the following wdEditorType constants.
Remarks
You can also use the NextRange property of the Editor object to return the next range for which the user has permission to modify.

GoToNext(What)

Returns a Range object that refers to the start position of the next item or location specified by the What argument. If you apply this method to the Selection object, the method moves the selection to the specified item (except for the wdGoToGrammaticalError, wdGoToProofreadingError, and wdGoToSpellingError constants). Range object.
Note  When you use this method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range object that's returned includes any grammar error text or spelling error text.
What  Required WdGoToItem.

GoToPrevious(What)

Returns a Range object that refers to the start position of the previous item or location specified by the What argument. If applied to a Selection object, GoToPrevious moves the selection to the specified item. Range object.
What  Required The item that the specified range or selection is to be moved to. WdGoToItem.
Returns True if the range or selection to which the method is applied is contained in the range specified by the Range argument.

InsertAfter(Text)

Inserts the specified text at the end of a range or selection. After this method is applied, the range or selection expands to include the new text.
Text   Required String. The text to be inserted.
Remarks
You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertAfter method. You can also use the following Visual Basic constants: vbCr, vbLf, vbCrLf and vbTab.
If you use this method with a range or selection that refers to an entire paragraph, the text is inserted after the ending paragraph mark (the text will appear at the beginning of the next paragraph). To insert text at the end of a paragraph, determine the ending point and subtract 1 from this location (the paragraph mark is one character), as shown in the following example.

Set doc = ActiveDocument
Set rngRange = _
    doc.Range(doc.Paragraphs(1).Start, doc.Paragraphs(1).End - 1)
    rngRange.InsertAfter " This is now the last sentence in paragraph one."

However, if the range or selection ends with a paragraph mark that also happens to be the end of the document, Microsoft Word inserts the text before the final paragraph mark rather than creating a new paragraph at the end of the document.
Also, if the range or selection is a bookmark, Word inserts the specified text but does not extend the range or selection or the bookmark to include the new text.

InsertAutoText

Attempts to match the text in the specified range or the text surrounding the range with an existing AutoText entry name. If any such match is found, InsertAutoText inserts the AutoText entry to replace that text. If a match cannot be found, an error occurs.
Note  You can use the Insert method with an AutoTextEntry object to insert a specific AutoText entry.

InsertBefore(Text)

Inserts the specified text before the specified selection or range. After the text is inserted, the selection or range is expanded to include the new text. If the selection or range is a bookmark, the bookmark is also expanded to include the next text.
Text   Required String. The text to be inserted.
Remarks
You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertBefore method. You can also use the following Visual Basic constants: vbCr, vbLf, vbCrLf and vbTab.

InsertBreak(Type)

Inserts a page, column, or section break.
Type   Optional Variant. The type of break to be inserted.WdBreakType. The default value is wdPageBreak.
Remarks
When you insert a page or column break, the range or selection is replaced by the break. If you don't want to replace the range or selection, use the Collapse method before using the InsertBreak method. When you insert a section break, the break is inserted immediately preceding the Range or Selection object.
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.

InsertCaption(
Label,
Title,
TitleAutoText,
Position,
ExcludeLabel
)

Inserts a caption immediately preceding or following the specified range or selection.
Label   Required Variant. The caption label to be inserted. WdCaptionLabelID
If the label hasn't yet been defined, an error occurs. Use the Add method with the CaptionLabels object to define new caption labels.
Title   Optional Variant. The string to be inserted immediately following the label in the caption (ignored if TitleAutoText is specified).
TitleAutoText   Optional Variant. The AutoText entry whose contents you want to insert immediately following the label in the caption (overrides any text specified by Title).
Position   Optional Variant. Specifies whether the caption will be inserted above or below the Selection or Range object. WdCaptionPosition Can be either of the following WdCaptionPosition constants: wdCaptionPositionAbove or wdCaptionPositionBelow.
ExcludeLabel   Optional Variant. True does not include the text label, as defined in the Label parameter. False includes the specified label.

InsertCrossReference(
ReferenceType, ReferenceKind, ReferenceItem, InsertAsHyperlink, IncludePosition, SeparateNumbers, SeparatorString)

Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).
ReferenceType  Required Variant. The type of item for which a cross-reference is to be inserted. Can be any WdReferenceType or WdCaptionLabelID constant or a user defined caption label.
ReferenceKind  Required WdReferenceKind. The information to be included in the cross-reference.
ReferenceItem  Required Variant. If ReferenceType is wdRefTypeBookmark, this argument specifies a bookmark name. For all other ReferenceType values, this argument specifies the item number or name in the Reference type box in the Cross-reference dialog box. Use the GetCrossReferenceItems method to return a list of item names that can be used with this argument.
InsertAsHyperlink  Optional Variant. True to insert the cross-reference as a hyperlink to the referenced item.
IncludePosition  Optional Variant. True to insert "above" or "below," depending on the location of the reference item in relation to the cross-reference.
SeparateNumbers Optional Variant. True to use a separator to separate the numbers from the associated text. (Use only if the ReferenceType parameter is set to wdRefTypeNumberedItem and the ReferenceKind parameter is set to wdNumberFullContext.)
SeparatorString Optional Variant. Specifies the string to use as a separator if the SeparateNumbers parameter is set to True.
Remarks
If you specify wdPageNumber for the value of ReferenceKind, you may need to repaginate the document in order to see the correct cross-reference information.

InsertDatabase(
Format,
Style,
LinkToSource, Connection, SQLStatement, SQLStatement1, PasswordDocument, PasswordTemplate, WritePasswordDocument, WritePasswordTemplate, DataSource,
From,
To,
IncludeFields
)

Retrieves data from a data source (for example, a separate Microsoft Word document, a Microsoft Excel worksheet, or a Microsoft Access database) and inserts the data as a table in place of the specified range.
Format   Optional Variant. A format listed in the Formats box in the Table AutoFormat dialog box (Table menu). Can be any of the WdTableFormat constants. A border is applied to the cells in the table by default.
Style   Optional Variant. The attributes of the AutoFormat specified by Format that are applied to the table. Use the sum of any combination of the following values:

Value

Meaning

0 (zero)

None

1

Borders

2

Shading

4

Font

8

Color

16

Auto Fit

32

Heading Rows

64

Last Row

128

First Column

256

Last Column

 LinkToSource   Optional Variant. True to establish a link between the new table and the data source.
Connection   Optional Variant. A range within which to perform the query specified by SQLStatement. How you specify the range depends on how data is retrieved. For example:
When retrieving data through Open Database Connectivity (ODBC), you specify a connection string.
When retrieving data from Microsoft Excel by using dynamic data exchange (DDE), you specify a named range or "Entire Spreadsheet."
Security  Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).
When retrieving data from Microsoft Access, you specify the word "Table" or "Query" followed by the name of a table or query.
SQLStatement   Optional String. An optional query string that retrieves a subset of the data in a primary data source to be inserted into the document.
SQLStatement1   Optional String. If the query string is longer than 255 characters, SQLStatement denotes the first portion of the string and SQLStatement1 denotes the second portion.
PasswordDocument   Optional Variant. The password (if any) required to open the data source. (See Remarks below.)
PasswordTemplate   Optional Variant. If the data source is a Word document, this argument is the password (if any) required to open the attached template. (See Remarks below.)
WritePasswordDocument   Optional Variant. The password required to save changes to the document. (See Remarks below.)
WritePasswordTemplate   Optional Variant. The password required to save changes to the template. (See Remarks below.)
DataSource   Optional Variant. The path and file name of the data source.
From   Optional Variant. The number of the first data record in the range of records to be inserted.
To   Optional Variant. The number of the last data record in the range of records to be inserted.
IncludeFields   Optional Variant. True to include field names from the data source in the first row of the new table.
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.
Security  Avoid using the built-in system administrator (sa) logon account. Instead, make system administrators members of the sysadmin fixed server role, and have them use their own accounts to log on. Use sa only when there is no other way to log on. To prevent unauthorized access through the sa logon account, you should assign that account a strong, unique password.
Security  When possible, use Windows Authentication (also referred to as a trusted connection), which uses a Windows user account to connect to SQL Server. When a user connects through a Windows user account, SQL Server uses information in the Windows operating system to validate the account name and password. Before you can use Windows Authentication, a server administrator must configure SQL Server to use this mode of authentication. If Windows Authentication is not available, avoid saving users' logon information. It is more secure for users to enter their logon information each time they log on.

InsertDateTime(
DateTimeFormat, InsertAsField, InsertAsFullWidth, DateLanguage, CalendarType)

Inserts the current date or time, or both, either as text or as a TIME field.
DateTimeFormat   Optional Variant. The format to be used for displaying the date or time, or both. If this argument is omitted, Microsoft Word uses the short-date style from the Windows Control Panel (Regional Settings icon).
InsertAsField   Optional Variant. True to insert the specified information as a TIME field. The default value is True.
InsertAsFullWidth   Optional Variant. True to insert the specified information as double-byte digits. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
DateLanguage   Optional Variant. Sets the language in which to display the date or time. Can be either of the following WdDateLanguage constants: wdDateLanguageBidi or wdDateLanguageLatin. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
CalendarType   Optional Variant. Sets the calendar type to use when displaying the date or time. Can be either of the following WdCalendarTypeBi constants: wdCalendarTypeBidi or wdCalendarTypeGregorian. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

InsertFile(
FileName, Range, ConfirmConversions, Link,
Attachment
)

Inserts all or part of the specified file.
FileName   Required String. The path and file name of the file to be inserted. If you don't specify a path, Word assumes the file is in the current folder.
Range   Optional Variant. If the specified file is a Word document, this parameter refers to a bookmark. If the file is another type (for example, a Microsoft Excel worksheet), this parameter refers to a named range or a cell range (for example, R1C1:R3C4).
ConfirmConversions   Optional Variant. True to have Word prompt you to confirm conversion when inserting files in formats other than the Word Document format.
Link   Optional Variant. True to insert the file by using an INCLUDETEXT field.
Attachment   Optional Variant. True to insert the file as an attachment to an e-mail message.

InsertParagraph

Replaces the specified range or selection with a new paragraph.
Note  After this method has been used, the range or selection is the new paragraph.
Remarks
If you don't want to replace the range or selection, use the Collapse method before using this method. The InsertParagraphAfter method inserts a new paragraph following a Range or Selection object.

 InsertParagraph After

Inserts a paragraph mark after a range or selection.
Note  After this method is applied, the range or selection expands to include the new paragraph.

 InsertParagraph Before

Inserts a new paragraph before the specified selection or range.

Note  After this method is applied, the range or selection expands to include the new paragraph.

InsertSymbol(
CharacterNumber,
Font,
Unicode,
Bias
)

Inserts a symbol in place of the specified range or selection.
Note  If you don't want to replace the range or selection, use the Collapse method before you use this method.
CharacterNumber   Required Long. The character number for the specified symbol. This value will always be the sum of 31 and the number that corresponds to the position of the symbol in the table of symbols (counting from left to right). For example, to specify a delta character at position 37 in the table of symbols in the Symbol font, set CharacterNumber to 68.
Font   Optional Variant. The name of the font that contains the symbol.
Unicode   Optional Variant. True to insert the unicode character specified by CharacterNumber; False to insert the ANSI character specified by CharacterNumber. The default value is False.
Bias   Optional Variant. Sets the font bias for symbols. This argument is useful for setting the correct font bias for East Asian characters. Can be one of the following WdFontBias constants: wdFontBiasDefault, wdFontBiasDontCare, or wdFontBiasFareast. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

InsertXML(
XML,
Transform
)

Inserts the specified XML text into the specified range or selection. If the specified range or selection contains text, the InsertXML method replaces the existing text.
XML   Required String. The XML text to insert.
Transform   Optional Variant. The transform to apply to the inserted XML text.
Remarks
Use the InsertXML method to insert text marked up with either arbitrary XML or Word XML. The XML must be well formed. If it uses Word XML, then it must also be valid according to the Word XML schema. For more information on the  Word XML schema, please refer to the Word XML Content Development Kit, which you can find on the Microsoft Developer Network (MSDN) Web site.
If the specified XML text cannot be inserted into the specified range or selection, an error message is displayed.

InStory(Range)

True if the selection or range to which this method is applied is in the same story as the range specified by the Range argument.
Note  A range can belong to only one story.
Range   Required Range object. The Range object whose story is compared with the story that contains expression.

IsEqual(Range)

True if the selection or range to which this method is applied is equal to the range specified by the Range argument. This method compares the starting and ending character positions, as well as the story type. If all three of these items are the same for both objects, the objects are equal.
Range   Required Range object. The Range object that's compared with expression.

LookupNameProperties

Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name. If this method finds more than one match, it displays the Check Names dialog box.

ModifyEnclosure(
Style,
Symbol,
EnclosedText
)

Adds, modifies, or removes an enclosure around the specified character or characters.
Style   Required Variant. The style of the enclosure. Can be any WdEncloseStyle constant.
Symbol   Optional Variant. The symbol in which to enclose the specified range. Can be any WdEnclosureType constant.
EnclosedText   Optional Variant. The characters that you want to enclose. If you include this argument, Microsoft Word replaces the specified range with the enclosed characters. If you don't specify text to enclose, Microsoft Word encloses all text in the specified range.

Move(Unit, Count)

Collapses the specified range or selection to its start or end position and then moves the collapsed object by the specified number of units. This method returns a Long value that indicates the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.
Unit  Optional Variant. The unit by which the collapsed range or selection is to be moved. Can be one of the following WdUnits constants: wdCharacter, wdWord, wdSentence, wdParagraph, wdSection, wdStory, wdCell, wdColumn, wdRow, or wdTable. If expression returns a Selection object, you can also use wdLine. The default value is wdCharacter.
Count  Optional Variant. The number of units by which the specified range or selection is to be moved. If Count is a positive number, the object is collapsed to its end position and moved backward in the document by the specified number of units. If Count is a negative number, the object is collapsed to its start position and moved forward by the specified number of units. The default value is 1. You can also control the collapse direction by using the Collapse method before using the Move method. If the range or selection is in the middle of a unit or isn't collapsed, moving it to the beginning or end of the unit counts as moving it one full unit.
Remarks
The start and end positions of a collapsed range or selection are equal.
Applying the Move method to a range doesn't rearrange text in the document. Instead, it redefines the range to refer to a new location in the document.
If you apply the Move method to any range other than a Range object variable (for example, Selection.Paragraphs(3).Range.Move), the method has no effect.
Moving a Selection object collapses the selection and moves the insertion point either forward or backward in the document.

MoveEnd(Unit, Count)

Moves the ending character position of a range or selection. This method returns an integer that indicates the number of units the range or selection actually moved, or it returns 0 (zero) if the move was unsuccessful.
Unit   Optional WdUnits . The unit by which to move the ending character position.
If expression returns a Selection object, wdLine can also be used. The default value is wdCharacter.
Count   Optional Variant. The number of units to move. If this number is positive, the ending character position is moved forward in the document. If this number is negative, the end is moved backward. If the ending position overtakes the starting position, the range collapses and both character positions move together. The default value is 1.

MoveEndUntil(
Cset,
Count
)

Moves the end position of the specified range or selection until any of the specified characters are found in the document. If the movement is forward in the document, the range or selection is expanded.
Remarks
This method returns the number of characters by which the end position of the specified range or selection was moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus 1. If Count is less than 0 (zero), this method returns the number of characters moved minus 1. If no Cset characters are found, the range or selection isn't changed and the method returns 0 (zero). If the end position is moved backward to a point that precedes the original start position, the start position is set to the new ending position.
Cset   Required Variant. One or more characters. This argument is case sensitive.
Count   Optional Variant. The maximum number of characters by which the specified range or selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range or selection is moved forward in the document. If it's a negative number, the range or selection is moved backward. The default value is wdForward.

MoveEndWhile(
Cset,
Count
)

Moves the ending character position of a range or selection while any of the specified characters are found in the document.
Remarks
While any character in Cset is found, the end position of the specified range or selection is moved. This method returns the number of characters that the end position of the range or selection moved as a Long value. If no Cset characters are found, the range or selection isn't changed and the method returns 0 (zero). If the end position is moved backward to a point that precedes the original start position, the start position is set to the new end position.
Cset   Required Variant. One or more characters. This argument is case sensitive.
Count   Optional Variant. The maximum number of characters by which the range or selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range or selection is moved forward in the document. If it's a negative number, the range or selection is moved backward. The default value is wdForward.

MoveStart(
Unit,
Count
)

Moves the start position of the specified range or selection. This method returns an integer that indicates the number of units by which the start position or the range or selection actually moved, or it returns 0 (zero) if the move was unsuccessful.
Unit   Optional WdUnits . The unit by which start position of the specified range or selection is to be moved.
The default value is wdCharacter.
Count   Optional Variant. The maximum number of units by which the specified range or selection is to be moved. If Count is a positive number, the start position of the range or selection is moved forward in the document. If it's a negative number, the start position is moved backward. If the start position is moved forward to a position beyond the end position, the range or selection is collapsed and both the start and end positions are moved together. The default value is 1.

MoveStartUntil(
Cset,
Count
)

Moves the start position of the specified range or selection until one of the specified characters is found in the document. If the movement is backward through the document, the range or selection is expanded.
Remarks
This method returns the number of characters by which the start position of the specified range or selection moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus 1. If Count is less than 0 (zero), this method returns the number of characters moved minus 1. If no Cset characters are found, the specified range or selection isn't changed and the method returns 0 (zero). If the start position is moved forward to a point beyond the end position, the range or selection is collapsed and both the start and end positions are moved together.
Cset   Required Variant. One or more characters. This argument is case sensitive.
Count   Optional Variant. The maximum number of characters by which the specified range or selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range or selection is moved forward in the document. If it's a negative number, the range or selection is moved backward. The default value is wdForward.

MoveStartWhile(
Cset,
Count
)

Moves the start position of the specified range or selection while any of the specified characters are found in the document.
Remarks
While any character in Cset is found, the start position of the range or selection is moved. This method returns the number of characters that the start position of the range or selection moved as a Long value. If not Cset characters are found, the range or selection isn't changed and the method returns 0 (zero). If the start position is moved forward to a position beyond the original end position, the end position is set to the new start position.
Cset   Required Variant. One or more characters. This argument is case sensitive.
Count   Optional Variant. The maximum number of characters by which the specified range or selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range or selection is moved forward in the document. If it's a negative number, the range or selection is moved backward. The default value is wdForward.

MoveUntil(
Cset,
Count
)

Moves the specified range or selection until one of the specified characters is found in the document.
Cset   Required Variant. One or more characters. If any character in Cset is found before the Count value expires, the specified range or selection is positioned as an insertion point immediately before that character. This argument is case sensitive.
Count   Optional Variant. The maximum number of characters by which the specified range or selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range or selection is moved forward in the document, beginning at the end position. If it's a negative number, the range or selection is moved backward, beginning at the start position. The default value is wdForward.
Remarks
This method returns the number of characters by which the specified range or selection was moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus one. If Count is less than 0 (zero), this method returns the number of characters moved minus one. If no Cset characters are found, the range or selection isn't not changed and the method returns 0 (zero).

MoveWhile(
Cset,
Count
)

Moves the specified range or selection while any of the specified characters are found in the document.
Remarks
While any character in Cset is found, the specified range or selection is moved. The resulting Range or Selection object is positioned as an insertion point after whatever Cset characters were found. This method returns the number of characters by which the specified range or selection was moved, as a Long value. If no Cset characters are found, the range or selection isn't changed and the method returns 0 (zero).
Cset   Required Variant. One or more characters. This argument is case sensitive.
Count   Optional Variant. The maximum number of characters by which the specified range or selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the specified range or selection is moved forward in the document, beginning at the end position. If it's a negative number, the range or selection is moved backward, beginning at the start position. The default value is wdForward.

Next(Unit, Count)

Returns a Range object that represents the specified unit relative to the specified selection or range.
Unit  Optional Variant. The type of units by which to count. Can be any WdUnits constant.
Count  Optional Variant. The number of units by which you want to move ahead. The default value is one.
Remarks
If the Range or Selection is just before the specified Unit, the Range or Selection is moved to the following unit. For example, if the Selection is just before a word, the following instruction moves the Selection forward to the following word.
Selection.Next(Unit:=wdWord, Count:=1).Select

NextSubdocument

Moves the range or selection to the next subdocument. If there isn't another subdocument, an error occurs.

Paste

Inserts the contents of the Clipboard at the specified range or selection. If you don't want to replace the contents of the range or selection, use the Collapse method before using this method.
Remarks
When this method is used with a range object, the range expands to include the contents of the Clipboard. When this method is used with a selection object, the selection doesn't expand to include the Clipboard contents; instead, the selection is positioned after the pasted Clipboard contents.

PasteAndFormat(Type)

Pastes the selected table cells and formats them as specified.
Type  Required WdRecoveryType. The type of formatting to use when pasting the selected table cells.

PasteAppendTable

Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.

PasteAsNestedTable

Pastes a cell or group of cells as a nested table into the selected range.

PasteExcelTable(
LinkedToExcel, WordFormatting,
RTF
)

Pastes and formats a Microsoft Excel table.
LinkedToExcel  Required Boolean. True links the pasted table to the original Excel file so that changes made to the Excel file are reflected in Microsoft Word.
WordFormatting  Required Boolean. True formats the table using the formatting in the Word document. False formats the table according to the original Excel file.
RTF  Required Boolean. True pastes the Excel table using Rich Text Format (RTF). False pastes the Excel table as HTML.

PasteSpecial(
IconIndex,
Link,
Placement, DisplayAsIcon, DataType,
IconFileName,
IconLabel
)

Inserts the contents of the Clipboard. Unlike with the Paste method, with PasteSpecial you can control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Excel worksheet).
Note  If you don't want to replace the contents of the specified range or selection, use the Collapse method before you use this method. When you use this method, the range or selection doesn't expand to include the contents of the Clipboard.
IconIndex  Optional Variant. If DisplayAsIcon is True, this argument is a number that corresponds to the icon you want to use in the program file specified by IconFilename. Icons appear in the Change Icon dialog box (Insert menu, Object command, Create New tab): 0 (zero) corresponds to the first icon, 1 corresponds to the second icon, and so on. If this argument is omitted, the first (default) icon is used.
Link  Optional Variant. True to create a link to the source file of the Clipboard contents. The default value is False.
Placement  Optional Variant. Can be either of the following WdOLEPlacement constants: wdFloatOverText or wdInLine. The default value is wdInLine.
DisplayAsIcon  Optional Variant.Optional Variant. True to display the link as an icon. The default value is False.
DataType  Optional Variant. A format for the Clipboard contents when they're inserted into the document. WdPasteDataType.
IconFileName  Optional Variant.If DisplayAsIcon is True, this argument is the path and file name for the file in which the icon to be displayed is stored.
IconLabel  Optional Variant.If DisplayAsIcon is True, this argument is the text that appears below the icon.

PhoneticGuide(
Text,
Alignment,
Raise,
FontSize,
FontName
)

Adds phonetic guides to the specified range.
Text  Required String. The phonetic text to add.
Alignment  Optional WdPhoneticGuideAlignmentType . The alignment of the added phonetic text.
Raise  Optional Long. The distance (in points) from the top of the text in the specified range to the top of the phonetic text. If no value is specified, Microsoft Word automatically sets the phonetic text at an optimum distance above the specified range.
FontSize  Optional Long. The font size to use for the phonetic text. If no value is specified, Word uses a font size 50 percent smaller than the text in the specified range.
FontName  Optional String. The name of the font to use for the phonetic text. If no value is specified, Word uses the same font as the text in the specified range.

Previous(Unit, Count)

Returns a Range object relative to the specified selection or range.
Note  If the Range or Selection is just after the specified Unit, the Range or Selection is moved to the previous unit. For example, if the Selection is just after a word (before the trailing space), the following instruction moves the Selection backwards to the previous word.
Selection.Previous(Unit:=wdWord, Count:=1).Select
Unit  Optional Variant. WdUnits
Count  Optional Variant. The number of units by which you want to move back. The default value is 1.

PreviousSubdocument

Moves the range or selection to the previous subdocument. If there isn't another subdocument, an error occurs.

Relocate(Direction)

In outline view, moves the paragraphs within the specified range after the next visible paragraph or before the previous visible paragraph. Body text moves with a heading only if the body text is collapsed in outline view or if it's part of the range.
Direction  Required WdRelocate . The direction of the move.

Select

Selects the specified object.
Note  After using this method, use the Selection property to work with the selected items. For more information, see Working with the Selection object.

SetRange(Start, End)

Sets the starting and ending character positions for the range or selection.
Note  Character position values start at the beginning of the story, with the first value being 0 (zero). All characters are counted, including nonprinting characters. Hidden characters are counted even if they're not displayed.
Start   Required Long. The starting character position of the range or selection.
End   Required Long. The ending character position of the range or selection.
Remarks
The SetRange method redefines the starting and ending positions of an existing Selection or Range object. This method differs from the Range method, which is used to create a range, given a starting and ending position.

Sort(
ExcludeHeader, FieldNumber, SortFieldType, SortOrder, FieldNumber2, SortFieldType2, SortOrder2, FieldNumber3, SortFieldType3, SortOrder3,
SortColumn,
Separator, CaseSensitive,
BidiSort,
IgnoreThe, IgnoreKashida, IgnoreDiacritics, IgnoreHe,
LanguageID
)

Sorts the paragraphs in the specified range or selection.
ExcludeHeader  Optional Variant. True to exclude the first row or paragraph header from the sort operation. The default value is False.
FieldNumber, FieldNumber2  , FieldNumber3Optional Variant. The fields to sort by. Microsoft Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.
SortFieldType, SortFieldType2, SortFieldType3  Optional Variant. The respective sort types for FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the WdSortFieldType constants.
The default value is wdSortFieldAlphanumeric. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SortOrder, SortOrder2, SortOrder3  Optional Variant. The sorting order to use when sorting FieldNumber, FieldNumber2, and FieldNumber3. Can be one WdSortOrder constant.
SortColumn  Optional Variant. True to sort only the column specified by the Range or Selection object.
Separator  Optional Variant. The type of field separator. Can be one of the WdSortSeparator constants.
CaseSensitive  Optional Variant. True to sort with case sensitivity. The default value is False.
BidiSort  Optional Variant. True to sort based on right-to-left language rules. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreThe  Optional Variant. True to ignore the Arabic character alef lam when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreKashida  Optional Variant. True to ignore kashidas when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreDiacritics  Optional Variant. True to ignore bidirectional control characters when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreHe  Optional Variant. True to ignore the Hebrew character he when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
LanguageID  Optional Variant. LanguageIDOptional Variant. Specifies the sorting language. Can be one of the WdLanguageID constants. Refer to the Object Browser for a list of the WdLanguageID constants.
SubFieldNumber, SubFieldNumber2, SubFieldNumber3  Optional Variant. (Applies to the Selection object only.)

SortAscending

Sorts paragraphs or table rows in ascending alphanumeric order. The first paragraph or table row is considered a header record and isn't included in the sort. Use the Sort method to include the header record in a sort.
Note  This method offers a simplified form of sorting intended for mail merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

SortDescending

Sorts paragraphs or table rows in descending alphanumeric order. The first paragraph or table row is considered a header record and isn't included in the sort. Use the Sort method to include the header record in a sort.
Note  This method offers a simplified form of sorting intended for mail-merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

StartOf(Unit, Extend)

Moves or extends the start position of the specified range or selection to the beginning of the nearest specified text unit. This method returns a Long that indicates the number of characters by which the range or selection was moved or extended. The method returns a negative number if the movement is backward through the document.
Unit  Optional WdUnits . The unit by which the start position of the specified range or selection is to be moved.
Extend  Optional WdMovement .
Remarks
If the beginning of the specified range or selection is already at the beginning of the specified unit, this method doesn't move or extend the range or selection. For example, if the selection is at the beginning of a line, the following example returns 0 (zero) and doesn't change the selection.
char = Selection.StartOf(Unit:=wdLine, Extend:=wdMove)

TCSCConverter(
WdTCSCConverterDirection, CommonTerms,
UseVariants
)

Converts the specified range from Traditional Chinese to Simplified Chinese or vice versa.
WdTCSCConverterDirection  Optional WdTCSCConverterDirection .
CommonTerms  Optional Boolean. True if Microsoft Word converts common expressions intact rather than converting on a character-by-character basis.
UseVariants  Optional Boolean. True if Word uses Taiwan, Hong Kong SAR, and Macao SAR character variants. Can only be used if translating from Simplified Chinese to Traditional Chinese.

WholeStory

Expands a range or selection to include the entire story.
Remarks
The following instructions, where myRange is a valid Range object, are functionally equivalent:
myRange.WholeStory
myRange.Expand Unit:=wdStory

Enumeration WdInformation

Constant

Value

 Description

wdActiveEndAdjustedPageNumber

1

Returns the number of the page that contains the active end of the specified selection or range. If you set a starting page number or make other manual adjustments, returns the adjusted page number (unlike wdActiveEndPageNumber).

wdActiveEndPageNumber

3

Returns the number of the page that contains the active end of the specified selection or range, counting from the beginning of the document. Any manual adjustments to page numbering are disregarded (unlike wdActiveEndAdjustedPageNumber).

wdActiveEndSectionNumber

2

Returns the number of the section that contains the active end of the specified selection or range.

wdAtEndOfRowMarker

31

Returns True if the specified selection or range is at the end-of-row mark in a table.

wdCapsLock

21

Returns True if Caps Lock is in effect.

wdEndOfRangeColumnNumber

17

Returns the table column number that contains the end of the specified selection or range.

wdEndOfRangeRowNumber

14

Returns the table row number that contains the end of the specified selection or range.

wdFirstCharacterColumnNumber

9

Returns the character position of the first character in the specified selection or range. If the selection or range is collapsed, the character number immediately to the right of the range or selection is returned (this is the same as the character column number displayed in the status bar after "Col").

wdFirstCharacterLineNumber

10

Returns the character position of the first character in the specified selection or range. If the selection or range is collapsed, the character number immediately to the right of the range or selection is returned (this is the same as the character line number displayed in the status bar after "Ln").

wdFrameIsSelected

11

Returns True if the selection or range is an entire frame or text box.

wdHeaderFooterType

33

Returns a value that indicates the type of header or footer that contains the specified selection or range, as shown in the following table.

wdHorizontalPositionRelativeToPage

5

Returns the horizontal position of the specified selection or range; this is the distance from the left edge of the selection or range to the left edge of the page measured in points (1 point = 20 twips, 72 points = 1 inch). If the selection or range isn't within the screen area, returns – 1.

wdHorizontalPositionRelativeToTextBoundary

7

Returns the horizontal position of the specified selection or range relative to the left edge of the nearest text boundary enclosing it, in points (1 point = 20 twips, 72 points = 1 inch). If the selection or range isn't within the screen area, returns - 1.

wdInClipboard

38

For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.

wdInCommentPane

26

Returns True if the specified selection or range is in a comment pane.

wdInEndnote

36

Returns True if the specified selection or range is in an endnote area in print layout view or in the endnote pane in normal view.

wdInFootnote

35

Returns True if the specified selection or range is in a footnote area in print layout view or in the footnote pane in normal view.

wdInFootnoteEndnotePane

25

Returns True if the specified selection or range is in the footnote or endnote pane in normal view or in a footnote or endnote area in print layout view. For more nformation, see the descriptions of wdInFootnote and wdInEndnote in the preceding paragraphs.

wdInHeaderFooter

28

Returns True if the selection or range is in the header or footer pane or in a header or footer in print layout view.

Value

Type of header or footer

- 1

None (the selection or range isn't in a header or footer)

0 (zero)

Even page header

1

Odd page header (or the only header, if there aren't odd and even headers)

2

Even page footer

3

Odd page footer (or the only footer, if there aren't odd and even footers)

4

First page header

5

First page footer

 

wdInMasterDocument

34

Returns True if the selection or range is in a master document (that is, a document that contains at least one subdocument).

wdInWordMail

37

Returns True if the selection or range is in the header or footer pane or in a header or footer in print layout view.

Value

Location

0(zero)

The selection or range isn't in an e-mail message.

1

The selection or range is in an e-mail message you are sending.

2

The selection or range is in an e-mail you are reading.

 

wdMaximumNumberOfColumns

18

Returns the greatest number of table columns within any row in the selection or range.

wdMaximumNumberOfRows

15

Returns the greatest number of table rows within the table in the specified selection or range.

wdNumberOfPagesInDocument

4

Returns the number of pages in the document associated with the selection or range.

wdNumLock

22

Returns True if Num Lock is in effect.

wdOverType

23

Returns True if Overtype mode is in effect. The Overtype property can be used to change the state of the Overtype mode.

wdReferenceOfType

32

Returns a value that indicates where the selection is in relation to a footnote, endnote, or comment reference, as shown in the following table.

Value

Description

– 1

The selection or range includes but isn't limited to a footnote, endnote, or comment reference.

0 (zero)

The selection or range isn't before a footnote, endnote, or comment reference.

1

The selection or range is before a footnote reference.

2

The selection or range is before an endnote reference.

3

The selection or range is before a comment reference.

 

wdRevisionMarking

24

Returns True if change tracking is in effect.

wdSelectionMode

20

Returns a value that indicates the current selection mode, as shown in the following table.

Value

Selection mode

0 (zero)

Normal selection

1

Extended selection ("EXT" appears on the status bar)

2

Column selection. ("COL" appears on the status bar)

 

wdStartOfRangeColumnNumber

16

Returns the table column number that contains the beginning of the selection or range.

wdStartOfRangeRowNumber

13

Returns the table row number that contains the beginning of the selection or range.

wdVerticalPositionRelativeToPage

6

Returns the vertical position of the selection or range; this is the distance from the top edge of the selection to the top edge of the page measured in points (1 point = 20 twips, 72 points = 1 inch). If the selection isn't visible in the document window, returns – 1.

wdVerticalPositionRelativeToTextBoundary

8

Returns the vertical position of the selection or range relative to the top edge of the nearest text boundary enclosing it, in points (1 point = 20 twips, 72 points = 1 inch). This is useful for determining the position of the insertion point within a frame or table cell. If the selection isn't visible, returns – 1.

wdWithInTable

12

Returns True if the selection is in a table.

wdZoomPercentage

19

Returns the current percentage of magnification as set by the Percentage property.

Enumeration WdStoryType

Constant

Value

wdCommentsStory

4

wdEndnoteContinuationNoticeStory

17

wdEndnoteContinuationSeparatorStory

16

wdEndnoteSeparatorStory

15

wdEndnotesStory

3

wdEvenPagesFooterStory

8

wdEvenPagesHeaderStory

6

wdFirstPageFooterStory

11

wdFirstPageHeaderStory

10

wdFootnoteContinuationNoticeStory

14

wdFootnoteContinuationSeparatorStory

13

wdFootnoteSeparatorStory

12

wdFootnotesStory

2

wdMainTextStory

1

wdPrimaryFooterStory

9

wdPrimaryHeaderStory

7

wdTextFrameStory

5

Enumeration WdTextOrientation

Constant

Value

wdTextOrientationDownward

3

wdTextOrientationHorizontal

0

wdTextOrientationHorizontalRotatedFarEast

4

wdTextOrientationUpward

2

wdTextOrientationVerticalFarEast

1

Enumeration WdTwoLinesInOneType

Constant

Value

wdTwoLinesInOneAngleBrackets

4

wdTwoLinesInOneCurlyBrackets

5

wdTwoLinesInOneNoBrackets

1

wdTwoLinesInOneNone

0

wdTwoLinesInOneParentheses

2

wdTwoLinesInOneSquareBrackets

3

Enumeration WdUnderline

Constant

Value

wdUnderlineDash

7

wdUnderlineDashHeavy

23

wdUnderlineDashLong

39

wdUnderlineDashLongHeavy

55

wdUnderlineDotDash

9

wdUnderlineDotDashHeavy

25

wdUnderlineDotDotDash

10

wdUnderlineDotDotDashHeavy

26

wdUnderlineDotted

4

wdUnderlineDottedHeavy

20

wdUnderlineDouble

3

wdUnderlineNone

0

wdUnderlineSingle

1

wdUnderlineThick

6

wdUnderlineWavy

11

wdUnderlineWavyDouble

43

wdUnderlineWavyHeavy

27

wdUnderlineWords

2

Enumeration WdTableFieldSeparator

Constant

Value

wdSeparateByCommas

2

wdSeparateByDefaultListSeparator

3

wdSeparateByParagraphs

0

wdSeparateByTabs

1

Enumeration WdTableFormat

Constant

Value

wdTableFormat3DEffects1

32

wdTableFormat3DEffects2

33

wdTableFormat3DEffects3

34

wdTableFormatClassic1

4

wdTableFormatClassic2

5

wdTableFormatClassic3

6

wdTableFormatClassic4

7

wdTableFormatColorful1

8

wdTableFormatColorful2

9

wdTableFormatColorful3

10

wdTableFormatColumns1

11

wdTableFormatColumns2

12

wdTableFormatColumns3

13

wdTableFormatColumns4

14

wdTableFormatColumns5

15

wdTableFormatContemporary

35

wdTableFormatElegant

36

wdTableFormatGrid1

16

wdTableFormatGrid2

17

wdTableFormatGrid3

18

wdTableFormatGrid4

19

wdTableFormatGrid5

20

wdTableFormatGrid6

21

wdTableFormatGrid7

22

wdTableFormatGrid8

23

wdTableFormatList1

24

wdTableFormatList2

25

wdTableFormatList3

26

wdTableFormatList4

27

wdTableFormatList5

28

wdTableFormatList6

29

wdTableFormatList7

30

wdTableFormatList8

31

wdTableFormatNone

0

wdTableFormatProfessional

37

wdTableFormatSimple1

1

wdTableFormatSimple2

2

wdTableFormatSimple3

3

wdTableFormatSubtle1

38

wdTableFormatSubtle2

39

wdTableFormatWeb1

40

wdTableFormatWeb2

41

wdTableFormatWeb3

42

Enumeration WdAutoFitBehavior

Constant

Value

wdAutoFitContent

1

wdAutoFitFixed

0

wdAutoFitWindow

2

Enumeration WdDefaultTableBehavior

Constant

Value

Description

wdWord8TableBehavior

0

Disables AutoFit. Default.

wdWord9TableBehavior

1

wdWord9TableBehavior Enables AutoFit.

Enumeration WdSpellingWordType

Constant

Value

wdAnagram

2

wdSpellword

0

wdWildcard

1

 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 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 WdReferenceType

Constant

Value

wdRefTypeBookmark

2

wdRefTypeEndnote

4

wdRefTypeFootnote

3

wdRefTypeHeading

1

wdRefTypeNumberedItem

0

Enumeration WdCaptionLabelID

Constant

Value

wdCaptionEquation

-3

wdCaptionFigure

-1

wdCaptionTable

-2

Enumeration WdReferenceKind

Constant

Value

wdContentText

-1

wdEndnoteNumber

6

wdEndnoteNumberFormatted

17

wdEntireCaption

2

wdFootnoteNumber

5

wdFootnoteNumberFormatted

16

wdNumberFullContext

-4

wdNumberNoContext

-3

wdNumberRelativeContext

-2

wdOnlyCaptionText

4

wdOnlyLabelAndNumber

3

wdPageNumber

7

wdPosition

15

Enumeration WdEncloseStyle

Constant

Value

wdEncloseStyleLarge

2

wdEncloseStyleNone

0

wdEncloseStyleSmall

1

Enumeration WdEnclosureType

Constant

Value

wdEnclosureCircle

0

wdEnclosureDiamond

3

wdEnclosureSquare

1

wdEnclosureTriangle

2

Enumeration WdUnits

Used with the following Selection methods:

Delete
EndKey
HomeKey
EndOf
StartOf

Expand
Next
Move

MoveDown
MoveUp
MoveStart
MoveEnd
MoveLeft
MoveRight

Constant

Value

wdCell

12

wdCharacter

1

wdCharacterFormatting

13

wdColumn

9

wdItem

16

wdLine (available only for Selection object)

5

wdParagraph

4

wdParagraphFormatting

14

wdRow

10

wdScreen

7

wdSection

8

wdSentence

3

wdStory

6

wdTable

15

wdWindow

11

wdWord

2

Enumeration WdPasteDataType

Constant

Value

wdPasteBitmap

4

wdPasteDeviceIndependentBitmap

5

wdPasteEnhancedMetafile

9

wdPasteHTML

10

wdPasteHyperlink

7

wdPasteMetafilePicture

3

wdPasteOLEObject

0

wdPasteRTF

1

wdPasteShape

8

wdPasteText

2

The default format varies, depending on the contents of the Clipboard.

Enumeration WdPhoneticGuideAlignmentType

Constant

Value

Description

wdPhoneticGuideAlignmentCenter

0

Microsoft Word centers phonetic text over the specified range. This is the default value.

wdPhoneticGuideAlignmentLeft

3

Word left-aligns phonetic text with the specified range.

wdPhoneticGuideAlignmentOneTwoOne

2

Word adjusts the inside and outside spacing of the phonetic text in a 1:2:1 ratio.

wdPhoneticGuideAlignmentRight

4

Word right-aligns phonetic text with the specified range.

wdPhoneticGuideAlignmentRightVertical

5

Word aligns the phonetic text on the right side of vertical text.

wdPhoneticGuideAlignmentZeroOneZero

1

Word adjusts the inside and outside spacing of the phonetic text in a 0:1:0 ratio.

Enumeration WdSortFieldType

Constant

Value

wdSortFieldAlphanumeric

0

wdSortFieldDate

2

wdSortFieldJapanJIS

4

wdSortFieldKoreaKS

6

wdSortFieldNumeric

1

wdSortFieldStroke

5

wdSortFieldSyllable

3

Enumeration WdSortOrder

Constant

Value

wdSortOrderAscending (Default)

0

wdSortOrderDescending

1

Enumeration WdSortSeparator

Constant

Value

wdSortSeparateByCommas (Default)

1

wdSortSeparateByDefaultTableSeparator

2

wdSortSeparateByTabs

0

Enumeration WdMovementType

Constant

Value

wdExtend

1

wdMove

0

Enumeration WdTCSCConverterDirection

Constant

Value

Description

wdTCSCConverterDirectionAuto

2

Default. Converts in the appropriate direction based on the detected language of the specified range.

wdTCSCConverterDirectionSCTC

0

Converts from Simplified Chinese to Traditional Chinese.

wdTCSCConverterDirectionTCSC

1

Converts from Traditional Chinese to Simplified Chinese.

Enumeration WdCharacterCase

Constant

Value

wdFullWidth

7

wdHalfWidth

6

wdHiragana

9

wdKatakana

8

wdLowerCase

0

wdNextCase

-1

wdTitleSentence

4

wdTitleWord

2

wdToggleCase

5

wdUpperCase

1

Enumeration WdCharacterWidth

Constant

Value

wdWidthFullWidth

7

wdWidthHalfWidth

6

Enumeration WdEmphasisMark

Constant

Value

wdEmphasisMarkNone

0

wdEmphasisMarkOverComma

2

wdEmphasisMarkOverSolidCircle

1

wdEmphasisMarkOverWhiteCircle

3

wdEmphasisMarkUnderSolidCircle

4

Enumeration WdColorIndex

Constant

Value

wdAuto

0

wdBlack

1

wdBlue

2

wdBrightGreen

4

wdByAuthor

-1

wdDarkBlue

9

wdDarkRed

13

wdDarkYellow

14

wdGray25

16

wdGray50

15

wdGreen

11

wdNoHighlight

0

wdPink

5

wdRed

6

wdTeal

10

wdTurquoise

3

wdViolet

12

wdWhite

8

wdYellow

7

Enumeration WdHorizontalInVerticalType

Constant

Value

wdHorizontalInVerticalFitInLine

1

wdHorizontalInVerticalNone

0

wdHorizontalInVerticalResizeLine

2

Enumeration WdKana

Constant

Value

wdKanaHiragana

9

wdKanaKatakana

8

Enumeration WdStatistic

Constant

Value

wdStatisticCharacters

3

wdStatisticCharactersWithSpaces

5

wdStatisticFarEastCharacters

6

wdStatisticLines

1

wdStatisticPages

2

wdStatisticParagraphs

4

wdStatisticWords

0

Enumeration WdBreakType

Constant

Value

wdColumnBreak

8

wdLineBreak

6

wdLineBreakClearLeft

9

wdLineBreakClearRight

10

wdPageBreak

7

wdSectionBreakContinuous

3

wdSectionBreakEvenPage

4

wdSectionBreakNextPage

2

wdSectionBreakOddPage

5

wdTextWrappingBreak

11

 


Etudes for Microsoft Word Programmers. Appendix. Object Range.


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