Finds text in the active Word document and can replace it by a new text value. Some properties of the replacement can be set.
Syntax
CHGVAR |
VAR(&CMD) VALUE('WREPLACE') |
CHGVAR |
VAR(&PARM1) VALUE(' Find="Text to find" [;ReplaceWith="New text"] [;MatchCase=True/False] [;MatchWholeWord=True/False] [;MatchWildcards=True/False] [;MatchSoundsLike=True/False] [;Replace=constant] [;Forward=True/False] [;Wrap=constant] ') |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Parameters
Parameters |
|
Parm1 |
Find: the text that will be searched. ReplaceWith: the
replacement text. MatchCase: True/False. True if the search must be case sensitive. False by default. MatchWholeWord: True/False. True to search for occurrences constituting whole words and not parts of words. False by default. MatchWildcards:
True/False. True to use wildcards and special operators. MatchSoundsLike: True/False. Searches words that sound phonetically but with a different spelling. False by default. Replace: indicates the number of replacements to perform: one, all or none. Uses the following constants: wdReplaceAll (default), wdReplaceNone, or wdReplaceOne. Forward: True/False. Search forward, near the end of the document. True by default. Wrap: WdFindAsk: After
replacing in the selection, Microsoft displays a message asking if you want
to search the rest of the document. |
|
Example
CHGVAR VAR(&CMD) VALUE('WORDOPEN')
CHGVAR VAR(&PARM1) VALUE('FILE="C:\TEMP\TEST.DOCX"')
CHGVAR VAR(&PARM2) VALUE('VISIBLE')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +
&PARM2 &RESULT)
CHGVAR VAR(&CMD) VALUE('WREPLACE')
CHGVAR VAR(&PARM1) VALUE('FIND="Bonjour";+
REPLACEWITH="Hello"')
CHGVAR VAR(&PARM2) VALUE(' ')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +
&PARM2 &RESULT)
See also