Protect the active Word document from modifications.
If a documents is protected, the user is allowed to make only some restricted modifications : comments, modify the document, but the track changes option is enabled.
Syntax
CHGVAR |
VAR(&CMD) VALUE('WPROTECT') |
CHGVAR |
VAR(&PARM1)
VALUE(' |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT)) |
MONMSG |
MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR)) |
Parameters
Parameters |
|
Parm1 |
Level is used
to set the protection level to apply to the document. • wdAllowOnlyComments : only comments are allowed. • wdAllowOnlyFormFields : document is considered as form. • wdAllowOnlyRevisions : changes with traking are allowed. • wdNoProtection : no protection.
PWD : password associated to the protection.
UnProtect : remove protection of the document. Only the PWD parameter is taking into account with this option.
The following options only apply if Level is equal to wdAllowOnlyFormFields :
-
Sections allows
to choose the sections to protect, or to exclude from the protection. Section
numbers are enclosed in quotation marks, separated by commas. - Exclude : the sections specified into the Sections parameter are not protected. Others sections of the document are protected. - Add : the sections specified into the Sections parameter are protected. Others sections of the document remain unchanged. - Remove : the protection of the sections specified into the Sections parameter is removed. Others sections of the document remain unchanged.
If the Exclude, Add and Remove options are not present, the protection is applied to the sections specified into the Sections parameter, and removed for the others ones. |
|
|
Note
If the wdAllowOnlyFormFields level is applied on a document containing no form fields, therefore no modification will be possible on the document.
Examples
CHGVAR |
VAR(&CMD) VALUE('WPROTECT') |
CHGVAR |
VAR(&PARM1) VALUE('Level=wdallownonlycomments') |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT)) |
MONMSG |
MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR)) |
CHGVAR |
VAR(&CMD) VALUE('WPROTECT') |
CHGVAR |
VAR(&PARM1) VALUE('Level=wdAllowOnlyFormFields') |
CHGVAR |
VAR(&PARM2) VALUE('Sections ="2,3,5"') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT)) |
MONMSG |
MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR)) |
CHGVAR |
VAR(&CMD) VALUE('WPROTECT') |
CHGVAR |
VAR(&PARM1) VALUE('Level= wdAllowOnlyFormFields') |
CHGVAR |
VAR(&PARM2) VALUE('Sections="*CURRENT";Exclude') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT)) |
MONMSG |
MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR)) |
See also