问题
I am searching for the correct syntax for my macro to find an IF Conditional statement field code.
I need to search for {IF{DOCVARIABLE"CODE"} = "YES" "A" "B"}
to remove this and replace with "B" (the false statement).
When searching for a word field like {DOCVARIABLE "CODE"}
alone, I write as: Text1 = "CODE"
but when there is an IF & Text & Yes & TRUE, FALSE like above, how do I write?
回答1:
Consolidated comment (OP crossposted elsewhere):
For that specific sequence, you can search for
^19IF^19DOCVARIABLE"CODE"
Word will select the entire IF field (so you will then need to parse the entire IF field anyway), but it should not select e.g.
{IF{DOCVARIABLE"BOX"}
If there is some variation (e.g. additional whitespace in the string) you may be able to use something like
^19^wIF^w^19^wDOCVARIABLE^w"CODE"
来源:https://stackoverflow.com/questions/14547866/vba-syntax-to-find-an-if-conditional-statement-field-code