MoveStart Method [Publisher 2003 VBA Language Reference]
Moves the start position of the specified range. This method returns a Long 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.
expression.MoveStart(Unit, Size)
expression Required. An expression that returns one of the objects in the Applies To list.
PbTextUnit
PbTextUnit can be one of these PbTextUnit constants. |
pbTextUnitCell |
pbTextUnitCharacter |
pbTextUnitCharFormat |
pbTextUnitCodePoint |
pbTextUnitColumn |
pbTextUnitLine |
pbTextUnitObject |
pbTextUnitParaFormat |
pbTextUnitParagraph |
pbTextUnitRow |
pbTextUnitScreen |
pbTextUnitSection |
pbTextUnitSentence |
pbTextUnitStory |
pbTextUnitTable |
pbTextUnitWindow |
pbTextUnitWord |
Size Required Long. 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.
Remarks
Use the MoveEnd method to move the ending character position for a range.
Example
This example sets a text range, moves the range's starting and ending character positions, and then formats the font for the range.
Sub MoveStartEnd()
Dim rngText As TextRange
Set rngText = ActiveDocument.Pages(1).Shapes(1).TextFrame _
.TextRange.Paragraphs(Start:=3, Length:=1)
With rngText
.MoveStart Unit:=pbTextUnitLine, Size:=-2
.MoveEnd Unit:=pbTextUnitLine, Size:=1
With .Font
.Bold = msoTrue
.Size = 15
End With
End With
End Sub
Applies to | TextRange Object