简体   繁体   中英

Determine if text is a field using VBA and Word

I'm using a Find/Execute routine to find some text. If that text is a field, I want to turn it into static text. As Word finds the text, how can I interrogate it using VBA to find out if it is a field result? I'm not asking for the full Find/Execute routine; I'm only asking for the syntax to test if text is a field result instead of static text.

I think that some variation of the following will work:

If Selection.Information(wdInFieldResult) = True Then
   Selection.Range.Fields.Unlink
End If

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