Range.Previous method (Word)
Returns the previous range a relative to the specified range.
Syntax
expression.Previous (Unit, Count)
expression Required. A variable that represents a Range object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
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 back. The default value is 1. |
Return value
Range
Remarks
If the Range object is just after the specified Unit, the Range object is moved to the previous unit. For example, if the Range object is just after a word (before the trailing space), the following instruction moves the Range object backward to the previous word.
ActiveDocument.Words(2).Previous(Unit:=wdWord, Count:=1).Select
Example
This example applies bold formatting to the first word in the active document.
ActiveDocument.Words(2) _
.Previous(Unit:=wdWord, Count:=1).Bold = True
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.
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk