Range object (Word)
Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.
Remarks
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. 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.
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)
For more information about working with Range objects, see Working with Range objects.
Methods
- AutoFormat
- Calculate
- CheckGrammar
- CheckSpelling
- CheckSynonyms
- Collapse
- ComputeStatistics
- ConvertHangulAndHanja
- ConvertToTable
- Copy
- CopyAsPicture
- Cut
- Delete
- DetectLanguage
- EndOf
- Expand
- ExportAsFixedFormat
- ExportAsFixedFormat2
- ExportFragment
- GetSpellingSuggestions
- GoTo
- GoToEditableRange
- GoToNext
- GoToPrevious
- ImportFragment
- InRange
- InsertAfter
- InsertAlignmentTab
- InsertAutoText
- InsertBefore
- InsertBreak
- InsertCaption
- InsertCrossReference
- InsertDatabase
- InsertDateTime
- InsertFile
- InsertParagraph
- InsertParagraphAfter
- InsertParagraphBefore
- InsertSymbol
- InsertXML
- InStory
- IsEqual
- LookupNameProperties
- ModifyEnclosure
- Move
- MoveEnd
- MoveEndUntil
- MoveEndWhile
- MoveStart
- MoveStartUntil
- MoveStartWhile
- MoveUntil
- MoveWhile
- Next
- NextSubdocument
- Paste
- PasteAndFormat
- PasteAppendTable
- PasteAsNestedTable
- PasteExcelTable
- PasteSpecial
- PhoneticGuide
- Previous
- PreviousSubdocument
- Relocate
- Select
- SetListLevel
- SetRange
- Sort
- SortAscending
- SortByHeadings
- SortDescending
- StartOf
- TCSCConverter
- WholeStory
Properties
- Application
- Bold
- BoldBi
- BookmarkID
- Bookmarks
- Borders
- Case
- Cells
- Characters
- CharacterStyle
- CharacterWidth
- Columns
- CombineCharacters
- Comments
- Conflicts
- ContentControls
- Creator
- DisableCharacterSpaceGrid
- Document
- Duplicate
- Editors
- EmphasisMark
- End
- EndnoteOptions
- Endnotes
- EnhMetaFileBits
- Fields
- Find
- FitTextWidth
- Font
- FootnoteOptions
- Footnotes
- FormattedText
- FormFields
- Frames
- GrammarChecked
- GrammaticalErrors
- HighlightColorIndex
- HorizontalInVertical
- HTMLDivisions
- Hyperlinks
- ID
- Information
- InlineShapes
- IsEndOfRowMark
- Italic
- ItalicBi
- Kana
- LanguageDetected
- LanguageID
- LanguageIDFarEast
- LanguageIDOther
- ListFormat
- ListParagraphs
- ListStyle
- Locks
- NextStoryRange
- NoProofing
- OMaths
- Orientation
- PageSetup
- ParagraphFormat
- Paragraphs
- ParagraphStyle
- Parent
- ParentContentControl
- PreviousBookmarkID
- ReadabilityStatistics
- Revisions
- Rows
- Scripts
- Sections
- Sentences
- Shading
- ShapeRange
- ShowAll
- SpellingChecked
- SpellingErrors
- Start
- StoryLength
- StoryType
- Style
- Subdocuments
- SynonymInfo
- Tables
- TableStyle
- Text
- TextRetrievalMode
- TextVisibleOnScreen
- TopLevelTables
- TwoLinesInOne
- Underline
- Updates
- WordOpenXML
- Words
- XML
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기