简体   繁体   中英

Using VBA, How to determin the Field's range in Word Document?

I am using the code below to get the field's range. is there a way to get the Field's range without Using the Selection Object?

dim Fld as Field
dim Rng as Range
dim Prev as Range
'... Ommited code ...
set Prev=Selection.Range
fld.Select
set Rng = Selection.Range 'new selection
Prev.Select ' restore previous selection
debug.print Rng.Paragraphs(1).Range.Text

如果您可以找到所需的字段,则可以使用其Result属性来获取范围。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM