PreviousNext
Help > Programming with LAUNCHER Office > LNCCMD commands > Commands list > WREPLACE command
WREPLACE command

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.
To remove all occurrences of a word or text, specify the empty string ("") for this argument.
If no value is given, the found text is simply selected.

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.
For example: ^p for a paragraph mark, ^t for a tabulation ...
False by default.

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.
WdFindContinue (default): The replace operation continues after selection.
WdFindStop: The replace operation ends when the end of the selection is reached.

 

 

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

WFINDTEXT