VBA syntax to find an if conditional statement field code

与世无争的帅哥 提交于 2019-12-12 03:46:49

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!