Selection Object Members

Word Developer Reference

Represents the current selection in a window or pane. A selection represents either a selected (or highlighted) area in the document, or it represents the insertion point if nothing in the document is selected. There can be only one Selection object per document window pane, and only one Selection object in the entire application can be active.

Methods

  Name Description
Bb257726.methods(en-us,office.12).gif BoldRun Adds the bold character format to or removes it from the current run.
Bb257726.methods(en-us,office.12).gif Calculate Calculates a mathematical expression within a selection. Returns the result as a Single.
Bb257726.methods(en-us,office.12).gif ClearCharacterAllFormatting Removes all character formatting (formatting applied either through character styles or manually applied formatting) from the selected text.
Bb257726.methods(en-us,office.12).gif ClearCharacterDirectFormatting Removes character formatting (formatting that has been applied manually using the buttons on the Ribbon or through the dialog boxes) from the selected text.
Bb257726.methods(en-us,office.12).gif ClearCharacterStyle Removes character formatting that has been applied through character styles from the selected text.
Bb257726.methods(en-us,office.12).gif ClearFormatting Removes text and paragraph formatting from a selection.
Bb257726.methods(en-us,office.12).gif ClearParagraphAllFormatting Removes all paragraph formatting (formatting applied either through paragraph styles or manually applied formatting) from the selected text.
Bb257726.methods(en-us,office.12).gif ClearParagraphDirectFormatting Removes paragraph formatting that has been applied manually (using the buttons on the Ribbon or through the dialog boxes) from the selected text.
Bb257726.methods(en-us,office.12).gif ClearParagraphStyle Removes paragraph formatting that has been applied through paragraph styles from the selected text.
Bb257726.methods(en-us,office.12).gif Collapse Collapses a selection to the starting or ending position. After a selection is collapsed, the starting and ending points are equal.
Bb257726.methods(en-us,office.12).gif ConvertToTable Converts text within a range to a table. Returns the table as a Table object.
Bb257726.methods(en-us,office.12).gif Copy Copies the specified selection to the Clipboard.
Bb257726.methods(en-us,office.12).gif CopyAsPicture The CopyAsPicture method works the same way as the Copy method.
Bb257726.methods(en-us,office.12).gif CopyFormat Copies the character formatting of the first character in the selected text.
Bb257726.methods(en-us,office.12).gif CreateAutoTextEntry Adds a new AutoTextEntry object to the AutoTextEntries collection, based on the current selection.
Bb257726.methods(en-us,office.12).gif CreateTextbox Adds a default-size text box around the selection.
Bb257726.methods(en-us,office.12).gif Cut Removes the specified object from the document and moves it to the Clipboard.
Bb257726.methods(en-us,office.12).gif Delete Deletes the specified number of characters or words.
Bb257726.methods(en-us,office.12).gif DetectLanguage Analyzes the specified text to determine the language that it is written in.
Bb257726.methods(en-us,office.12).gif EndKey Moves or extends the selection to the end of the specified unit.
Bb257726.methods(en-us,office.12).gif EndOf Moves or extends the ending character position of a range or selection to the end of the nearest specified text unit.
Bb257726.methods(en-us,office.12).gif EscapeKey Cancels a mode such as extend or column select (equivalent to pressing the ESC key).
Bb257726.methods(en-us,office.12).gif Expand Expands the specified range or selection. Returns the number of characters added to the range or selection. Long
Bb257726.methods(en-us,office.12).gif ExportAsFixedFormat Saves the current selection as PDF or XPS format.
Bb257726.methods(en-us,office.12).gif Extend Turns on extend mode, or if extend mode is already on, extends the selection to the next larger unit of text.
Bb257726.methods(en-us,office.12).gif GoTo Moves the insertion point to the character position immediately preceding the specified item, and returns a Range object (except for the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant).
Bb257726.methods(en-us,office.12).gif GoToEditableRange Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.
Bb257726.methods(en-us,office.12).gif GoToNext 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).
Bb257726.methods(en-us,office.12).gif GoToPrevious 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.
Bb257726.methods(en-us,office.12).gif HomeKey Moves or extends the selection to the beginning of the specified unit. This method returns an integer that indicates the number of characters the selection was actually moved, or it returns 0 (zero) if the move was unsuccessful.This method corresponds to functionality of the HOME key.
Bb257726.methods(en-us,office.12).gif InRange True if the selection to which the method is applied is contained within the range specified by the Range argument.
Bb257726.methods(en-us,office.12).gif InsertAfter Inserts the specified text at the end of a range or selection.
Bb257726.methods(en-us,office.12).gif InsertBefore Inserts the specified text before the specified selection.
Bb257726.methods(en-us,office.12).gif InsertBreak Inserts a page, column, or section break.
Bb257726.methods(en-us,office.12).gif InsertCaption Inserts a caption immediately preceding or following the specified selection.
Bb257726.methods(en-us,office.12).gif InsertCells Adds cells to an existing table.
Bb257726.methods(en-us,office.12).gif InsertColumns Inserts columns to the left of the column that contains the selection.
Bb257726.methods(en-us,office.12).gif InsertColumnsRight Inserts columns to the right of the current selection.
Bb257726.methods(en-us,office.12).gif InsertCrossReference 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).
Bb257726.methods(en-us,office.12).gif InsertDateTime Inserts the current date or time, or both, either as text or as a TIME field.
Bb257726.methods(en-us,office.12).gif InsertFile Inserts all or part of the specified file.
Bb257726.methods(en-us,office.12).gif InsertFormula Inserts an = (Formula) field that contains a formula at the selection.
Bb257726.methods(en-us,office.12).gif InsertNewPage Inserts a new page at the position of the Insertion Point.
Bb257726.methods(en-us,office.12).gif InsertParagraph Replaces the specified selection with a new paragraph.
Bb257726.methods(en-us,office.12).gif InsertParagraphAfter Inserts a paragraph mark after a selection.
Bb257726.methods(en-us,office.12).gif InsertParagraphBefore Inserts a new paragraph before the specified selection or range.
Bb257726.methods(en-us,office.12).gif InsertRows Inserts the specified number of new rows above the row that contains the selection. If the selection isn't in a table, an error occurs.
Bb257726.methods(en-us,office.12).gif InsertRowsAbove Inserts rows above the current selection.
Bb257726.methods(en-us,office.12).gif InsertRowsBelow Inserts rows below the current selection.
Bb257726.methods(en-us,office.12).gif InsertStyleSeparator Inserts a special hidden paragraph mark that allows Microsoft Word to join paragraphs formatted using different paragraph styles, so lead-in headings can be inserted into a table of contents.
Bb257726.methods(en-us,office.12).gif InsertSymbol Inserts a symbol in place of the specified selection.
Bb257726.methods(en-us,office.12).gif InsertXML Inserts the specified XML into the document at the cursor, replacing any selected text.
Bb257726.methods(en-us,office.12).gif InStory True if the selection to which this method is applied is in the same story as the range specified by the Range argument.
Bb257726.methods(en-us,office.12).gif IsEqual True if the selection to which this method is applied is equal to the range specified by the Range argument.
Bb257726.methods(en-us,office.12).gif ItalicRun Adds the italic character format to or removes it from the current run.
Bb257726.methods(en-us,office.12).gif LtrPara Sets the reading order and alignment of the specified paragraphs to left-to-right.
Bb257726.methods(en-us,office.12).gif LtrRun Sets the reading order and alignment of the specified run to left-to-right.
Bb257726.methods(en-us,office.12).gif Move Collapses the specified 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 represents the number of units by which the selection was moved, or it returns 0 (zero) if the move was unsuccessful.
Bb257726.methods(en-us,office.12).gif MoveDown Moves the selection down and returns the number of units it has been moved.
Bb257726.methods(en-us,office.12).gif MoveEnd Moves the ending character position of a range or selection.
Bb257726.methods(en-us,office.12).gif MoveEndUntil Moves the end position of the specified selection until any of the specified characters are found in the document.
Bb257726.methods(en-us,office.12).gif MoveEndWhile Moves the ending character position of a selection while any of the specified characters are found in the document.
Bb257726.methods(en-us,office.12).gif MoveLeft Moves the selection to the left and returns the number of units it has been moved.
Bb257726.methods(en-us,office.12).gif MoveRight Moves the selection to the right and returns the number of units it has been moved.
Bb257726.methods(en-us,office.12).gif MoveStart Moves the start position of the specified selection.
Bb257726.methods(en-us,office.12).gif MoveStartUntil Moves the start position of the specified selection until one of the specified characters is found in the document. If the movement is backward through the document, the selection is expanded.
Bb257726.methods(en-us,office.12).gif MoveStartWhile Moves the start position of the specified selection while any of the specified characters are found in the document.
Bb257726.methods(en-us,office.12).gif MoveUntil Moves the specified selection until one of the specified characters is found in the document.
Bb257726.methods(en-us,office.12).gif MoveUp Moves the selection up and returns the number of units that it has been moved.
Bb257726.methods(en-us,office.12).gif MoveWhile Moves the specified selection while any of the specified characters are found in the document.
Bb257726.methods(en-us,office.12).gif Next Returns a Range object that represents the next unit relative to the specified selection.
Bb257726.methods(en-us,office.12).gif NextField Selects the next field.
Bb257726.methods(en-us,office.12).gif NextRevision Locates and returns the next tracked change as a Revision object.
Bb257726.methods(en-us,office.12).gif NextSubdocument Moves the selection to the next subdocument.
Bb257726.methods(en-us,office.12).gif Paste Inserts the contents of the Clipboard at the specified selection.
Bb257726.methods(en-us,office.12).gif PasteAndFormat Pastes the selected table cells and formats them as specified.
Bb257726.methods(en-us,office.12).gif PasteAppendTable Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.
Bb257726.methods(en-us,office.12).gif PasteAsNestedTable Pastes a cell or group of cells as a nested table into the selection.
Bb257726.methods(en-us,office.12).gif PasteExcelTable Pastes and formats a Microsoft Excel table.
Bb257726.methods(en-us,office.12).gif PasteFormat Applies formatting copied with the CopyFormat method to the selection.
Bb257726.methods(en-us,office.12).gif PasteSpecial Inserts the contents of the Clipboard.
Bb257726.methods(en-us,office.12).gif Previous Moves the selected text by the specified number of units, and returns a Range object relative to the collapsed selection.
Bb257726.methods(en-us,office.12).gif PreviousField Selects and returns the previous field.
Bb257726.methods(en-us,office.12).gif PreviousRevision Locates and returns the previous tracked change as a Revision object.
Bb257726.methods(en-us,office.12).gif PreviousSubdocument Moves the selection to the previous subdocument.
Bb257726.methods(en-us,office.12).gif ReadingModeGrowFont Increases the size of the displayed text one point size when the document is displayed in Reading mode.
Bb257726.methods(en-us,office.12).gif ReadingModeShrinkFont Decreases the size of the displayed text one point size when the document is displayed in Reading mode.
Bb257726.methods(en-us,office.12).gif RtlPara Sets the reading order and alignment of the specified paragraphs to right-to-left.
Bb257726.methods(en-us,office.12).gif RtlRun Sets the reading order and alignment of the specified run to right-to-left.
Bb257726.methods(en-us,office.12).gif Select Selects the specified text.
Bb257726.methods(en-us,office.12).gif SelectCell Selects the entire cell containing the current selection.
Bb257726.methods(en-us,office.12).gif SelectColumn Selects the column that contains the insertion point, or selects all columns that contain the selection.
Bb257726.methods(en-us,office.12).gif SelectCurrentAlignment Extends the selection forward until text with a different paragraph alignment is encountered.
Bb257726.methods(en-us,office.12).gif SelectCurrentColor Extends the selection forward until text with a different color is encountered.
Bb257726.methods(en-us,office.12).gif SelectCurrentFont Extends the selection forward until text in a different font or font size is encountered.
Bb257726.methods(en-us,office.12).gif SelectCurrentIndent Extends the selection forward until text with different left or right paragraph indents is encountered.
Bb257726.methods(en-us,office.12).gif SelectCurrentSpacing Extends the selection forward until a paragraph with different line spacing is encountered.
Bb257726.methods(en-us,office.12).gif SelectCurrentTabs Extends the selection forward until a paragraph with different tab stops is encountered.
Bb257726.methods(en-us,office.12).gif SelectRow Selects the row that contains the insertion point, or selects all rows that contain the selection.
Bb257726.methods(en-us,office.12).gif SetRange Sets the starting and ending character positions for the selection.
Bb257726.methods(en-us,office.12).gif Shrink Shrinks the selection to the next smaller unit of text.
Bb257726.methods(en-us,office.12).gif ShrinkDiscontiguousSelection Cancels the selection of all but the most recently selected text when a selection contains multiple, unconnected selections.
Bb257726.methods(en-us,office.12).gif Sort Sorts the paragraphs in the specified selection.
Bb257726.methods(en-us,office.12).gif SortAscending Sorts paragraphs or table rows in ascending alphanumeric order.
Bb257726.methods(en-us,office.12).gif SortDescending Sorts paragraphs or table rows within the selection in descending alphanumeric order.
Bb257726.methods(en-us,office.12).gif SplitTable Inserts an empty paragraph above the first row in the selection.
Bb257726.methods(en-us,office.12).gif StartOf 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.
Bb257726.methods(en-us,office.12).gif ToggleCharacterCode Switches a selection between a Unicode character and its corresponding hexadecimal value.
Bb257726.methods(en-us,office.12).gif TypeBackspace Deletes the character preceding a collapsed selection (an insertion point).
Bb257726.methods(en-us,office.12).gif TypeParagraph Inserts a new, blank paragraph.
Bb257726.methods(en-us,office.12).gif TypeText Inserts the specified text.
Bb257726.methods(en-us,office.12).gif WholeStory Expands a selection to include the entire story.

Properties

  Name Description
Bb257726.properties(en-us,office.12).gif Active True if the selection in the specified window or pane is active. Read-only Boolean.
Bb257726.properties(en-us,office.12).gif Application Returns an Application object that represents the Microsoft Word application.
Bb257726.properties(en-us,office.12).gif BookmarkID Returns the number of the bookmark that encloses the beginning of the specified selection. Read-only Long.
Bb257726.properties(en-us,office.12).gif Bookmarks Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.
Bb257726.properties(en-us,office.12).gif Borders Returns a Borders collection that represents all the borders for the specified object.
Bb257726.properties(en-us,office.12).gif Cells Returns a Cells collection that represents the table cells in a selection. Read-only.
Bb257726.properties(en-us,office.12).gif Characters Returns a Characters collection that represents the characters in a document, range, or selection. Read-only.
Bb257726.properties(en-us,office.12).gif ChildShapeRange Returns a ShapeRange collection representing the child shapes contained within a selection.
Bb257726.properties(en-us,office.12).gif Columns Returns a Columns collection that represents all the table columns in a selection. Read-only.
Bb257726.properties(en-us,office.12).gif ColumnSelectMode True if column selection mode is active. Read/write Boolean.
Bb257726.properties(en-us,office.12).gif Comments Returns a Comments collection that represents all the comments in the specified. Read-only.
Bb257726.properties(en-us,office.12).gif Creator Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Bb257726.properties(en-us,office.12).gif Document Returns a Document object associated with the specified selection. Read-only.
Bb257726.properties(en-us,office.12).gif Editors Returns an Editors object that represents all the users authorized to modify a selection within a document.
Bb257726.properties(en-us,office.12).gif End Returns or sets the ending character position of a selection. Read/write Long.
Bb257726.properties(en-us,office.12).gif EndnoteOptions Returns an EndnoteOptions object that represents the endnotes in a selection.
Bb257726.properties(en-us,office.12).gif Endnotes Returns an Endnotes collection that represents all the endnotes conatined within a selection. Read-only.
Bb257726.properties(en-us,office.12).gif EnhMetaFileBits Returns a Variant that represents a picture representation of how a selection or range of text appears.
Bb257726.properties(en-us,office.12).gif ExtendMode True if Extend mode is active. Read/write Boolean.
Bb257726.properties(en-us,office.12).gif Fields Returns a read-only Fields collection that represents all the fields in the selection.
Bb257726.properties(en-us,office.12).gif Find Returns a Find object that contains the criteria for a find operation. Read-only.
Bb257726.properties(en-us,office.12).gif FitTextWidth Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection. Read/write Single.
Bb257726.properties(en-us,office.12).gif Flags Returns or sets properties of the selection. Read/write WdSelectionFlags.
Bb257726.properties(en-us,office.12).gif Font Returns or sets a Font object that represents the character formatting of the specified object. Read/write.
Bb257726.properties(en-us,office.12).gif FootnoteOptions Returns FootnoteOptions object that represents the footnotes in a selection.
Bb257726.properties(en-us,office.12).gif Footnotes Returns a Footnotes collection that represents all the footnotes in a range, selection, or document. Read-only.
Bb257726.properties(en-us,office.12).gif FormattedText Returns or sets a Range object that includes the formatted text in the specified range or selection. Read/write.
Bb257726.properties(en-us,office.12).gif FormFields Returns a FormFields collection that represents all the form fields in the selection. Read-only.
Bb257726.properties(en-us,office.12).gif Frames Returns a Frames collection that represents all the frames in a selection. Read-only.
Bb257726.properties(en-us,office.12).gif HasChildShapeRange True if the selection contains child shapes. Read-only Boolean.
Bb257726.properties(en-us,office.12).gif HeaderFooter Returns a HeaderFooter object for the specified selection. Read-only.
Bb257726.properties(en-us,office.12).gif HTMLDivisions Returns an HTMLDivisions object that represents an HTML division in a Web document.
Bb257726.properties(en-us,office.12).gif Hyperlinks Returns a Hyperlinks collection that represents all the hyperlinks in the specified selection. Read-only.
Bb257726.properties(en-us,office.12).gif Information Returns information about the specified selection. Read-only Variant.
Bb257726.properties(en-us,office.12).gif InlineShapes Returns an InlineShapes collection that represents all the InlineShape objects in a selection. Read-only.
Bb257726.properties(en-us,office.12).gif IPAtEndOfLine True if the insertion point is at the end of a line that wraps to the next line. Read-only Boolean.
Bb257726.properties(en-us,office.12).gif IsEndOfRowMark True if the specified selection or range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.
Bb257726.properties(en-us,office.12).gif LanguageDetected Returns or sets a Boolean that specifies whether Microsoft Word has detected the language of the selected text.
Bb257726.properties(en-us,office.12).gif LanguageID Returns or sets the language for the specified object. Read/write
Bb257726.properties(en-us,office.12).gif LanguageIDFarEast Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
Bb257726.properties(en-us,office.12).gif LanguageIDOther Returns or sets the language for the specified object. Read/write WdLanguageID.
Bb257726.properties(en-us,office.12).gif NoProofing 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. Read/write Long.
Bb257726.properties(en-us,office.12).gif OMaths Returns an OMaths collection that represents the OMath objects within the current selection. Read-only.
Bb257726.properties(en-us,office.12).gif Orientation Returns or sets the orientation of text in a selection when the Text Direction feature is enabled. Read/write WdTextOrientation.
Bb257726.properties(en-us,office.12).gif PageSetup Returns a PageSetup object that's associated with the specified selection. Read-only.
Bb257726.properties(en-us,office.12).gif ParagraphFormat Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified selection. Read/write.
Bb257726.properties(en-us,office.12).gif Paragraphs Returns a Paragraphs collection that represents all the paragraphs in the specified selection. Read-only.
Bb257726.properties(en-us,office.12).gif Parent Returns an Object that represents the parent object of the specified Selection object.
Bb257726.properties(en-us,office.12).gif PreviousBookmarkID 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 is no corresponding bookmark. Read-only Long.
Bb257726.properties(en-us,office.12).gif Range Returns a Range object that represents the portion of a document that's contained in the specified object.
Bb257726.properties(en-us,office.12).gif Rows Returns a Rows collection that represents all the table rows in a range, selection, or table. Read-only.
Bb257726.properties(en-us,office.12).gif Sections Returns a Sections collection that represents the sections in the specified selection. Read-only.
Bb257726.properties(en-us,office.12).gif Sentences Returns a Sentences collection that represents all the sentences in the selection. Read-only.
Bb257726.properties(en-us,office.12).gif Shading Returns a Shading object that refers to the shading formatting for the specified selection.
Bb257726.properties(en-us,office.12).gif ShapeRange Returns a ShapeRange collection that represents all the Shape objects in the selection. Read-only.
Bb257726.properties(en-us,office.12).gif SmartTags Returns a SmartTags object that represents a smart tag in a selection. Read-only.
Bb257726.properties(en-us,office.12).gif Start Returns or sets the starting character position of a selection. Read/write Long.
Bb257726.properties(en-us,office.12).gif StartIsActive True if the beginning of the selection is active. Read/write Boolean.
Bb257726.properties(en-us,office.12).gif StoryLength Returns the number of characters in the story that contains the specified selection. Read-only Long.
Bb257726.properties(en-us,office.12).gif StoryType Returns the story type for the specified selection. Read-only WdStoryType.
Bb257726.properties(en-us,office.12).gif Style 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. Read/write Variant.
Bb257726.properties(en-us,office.12).gif Tables Returns a Tables collection that represents all the tables in the specified selection. Read-only.
Bb257726.properties(en-us,office.12).gif Text Returns or sets the text in the specified selection. Read/write String.
Bb257726.properties(en-us,office.12).gif TopLevelTables Returns a Tables collection that represents the tables at the outermost nesting level in the current selection. Read-only.
Bb257726.properties(en-us,office.12).gif Type Returns the selection type. Read-only WdSelectionType.
Bb257726.properties(en-us,office.12).gif WordOpenXML Returns a String that represents the XML contained within the selection in the Microsoft Office Word Open XML format. Read-only.
Bb257726.properties(en-us,office.12).gif Words Returns a Words collection that represents all the words in a selection. Read-only.
Bb257726.properties(en-us,office.12).gif XML Returns a String that represents the XML text in the specified object.
Bb257726.properties(en-us,office.12).gif XMLNodes Returns an XMLNodes collection that represents the collection of all XML elements within a selection—including those elements that are only partially within the selection.
Bb257726.properties(en-us,office.12).gif XMLParentNode Returns an XMLNode object that represents the parent node of a selection.