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

 Sets a property value to the active Word document or the application.

 

Syntax 1

 

CHGVAR

VAR(&CMD) VALUE('WSETPROP')

CHGVAR

VAR(&PARM1) VALUE('Property')

CHGVAR

VAR(&PARM2) VALUE('Value')

CALL

PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +

&PARM2 &RESULT))

MONMSG

MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR))

 

Parameters

 

Parameters

 

Parm1

Full path to the property to modified.

Example : Selection.Font.Bold

Parm2

Value to assign to property.

  

Examples :

 

TRUE : True value

 

FALSE : False value

 

INT(chain) : When Word waits for an integer value.

 

 

 

 

Examples 1

 

1) The following example sets selection font color to red.

 

CHGVAR

VAR(&CMD) VALUE('WSETPROP')

CHGVAR

VAR(&PARM1) VALUE('Selection.Font.Color')

CHGVAR

VAR(&PARM2) VALUE('INT(255)')

CALL

PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +

&PARM2 &RESULT))

 Note :   Parm2 = INT(255) : Red Color.

 

 

2) This example inserts text in Page header and page footer.

 

LNCCMD CMD(WORDOPEN)

 

LNCCMD CMD(WOPENFILE) +

PARM1('%LNCDIR%\SAMPLES\MODELE_STYLE.DOC')

 

LNCCMD CMD(WSETPROP) +

PARM1(activewindow.activepane.view.seekview+

) PARM2(wdseekcurrentpageheader)

 

LNCCMD CMD(WTYPETEXT) PARM1('PAGE HEADER')

 

LNCCMD CMD(WSETPROP) +

PARM1(ACTIVEWINDOW.ACTIVEPANE.VIEW.SEEKVIEW+

) PARM2(WDSEEKCURRENTPAGEFOOTER)

 

LNCCMD CMD(WTYPETEXT) PARM1('PAGE FOOTER')

 

LNCCMD CMD(WORDSHOW)

 

3) This example puts the selection in bold.

 

LNCCMD     CMD(WSETPROP) PARM1('Selection.Font.Bold') +  

              PARM2('True')                               

 

4) This example disables the display of Word popups.

 

LNCCMD     CMD(WSETPROP) +                         

              PARM1('application.displayalerts') +  

              PARM2('wdalertsnone')                 

Syntax 2

 

CHGVAR

VAR(&CMD) VALUE('WSETPROP')

CHGVAR

VAR(&PARM1) VALUE('

Property="Property";

CHGVAR

Value="Value"')

CALL

PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +

&PARM2 &RESULT))

MONMSG

MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR))

 

Parameters

 

Parameters

 

Parm1

Property = Full path to property to modified.

or Parm2

Value = Value to assign to the property.

 

 

Example 2

 

LNCCMD     CMD(WSETPROP) PARM1('Property= "SELECTION.STYLE" ;Value=" ACCENTUATION"') + 

 

Note

The path to the property follows the syntax used in Visual Basic.

Some examples :

Selection.Font.Color: Changes the color of the selection.
Selection.Borders.Item(wdBorderLeft).LineStyle: Changes the style of the left border.
Selection.Font.Bold: Allows to put in bold the selection.

It is possible to use all the constants of Word and Visual Basic Application or the value of the constant itself.

When the path to the property includes an element of a collection (such as Selection.Borders, which has 4 borders), you must specify the element concerned (Item).