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

Opens WORD document.

This synthesis command is somewhat similar to WOPENFILE or WNEWFILE command with opportunity to include parameters equivalent to WORDSHOW/WORDHIDE and WMAXIMIZE/WMINIMIZE commands.

Word must be opened before with WORDOPEN command.

 

Syntax

 

CHGVAR

VAR(&CMD) VALUE('WDOCUMENT')

CHGVAR

VAR(&PARM1) VALUE('File name' OU ' 'Template name')

CHGVAR

VAR(&PARM2) VALUE('

[Directory="Directory path";]

[Document="File name";]

[Detach = True/False;]

[Visible;]

[ReadOnly;]

[New;]

[Minimize;]

[Maximize;]

[DOCPWD="Password for opening";]

[WRTPWD="Password for modification";]

')

CALL

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

&PARM2 &RESULT)

 

 Parameters

 

Parameters

 

Parm1

Name of the file to open. It may be empty if a new document has to be created, or includes a template name, if NEW is specified as parameter 2.

 

 

Parm2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

RESULT

Directory
This option allows you to specify a path to the directory where the document to be opened is located.

This directory path is added in front of the path and the file name given in parameter 1.

Document
By the keyword "Document", LAUNCHER Office is asked to search for the document among those already opened by Word on the system.

If the requested document is already open, it is made active, it becomes the current document for Word. No new file is opened, so the name of the file or template is ignored.

 

Detach = True/False
If "Detach" is true, Word detaches the data source from the current document or the new active document when the WDOCUMENT command is returned. By detaching the data source, the document is no longer a mail merge template for Word. The WMAILMERGE command will redo the attachment to a data source.

When a document is opened and attached to a data source (Merge File), it is maintained by Word, and therefore not editable. You must detach the data source from the current document if you want to send new data to the merge file.

 

VISIBLE =to show Word.

 

MINIMIZE= window is reduced.

 

MAXIMIZE= window is widened.

 

READONLY = open for reading only.

Default value is False

 

NEW = allows to create a new document if Parm1 is empty.

 

DOCPWD = opening password. Uppercase/lowercase must be respected if the document is password protected.

 

WRTPWD= modification password. Must be filled if the document is modification protected.

 

NOTICE !!! Word must be shown to open a password protected document.

 

 

Name of the document

When returning the WDOCUMENT command, the &RESULT parameter contains the name of the active document.

For a document opened from a file, the name of the document is equal to the name of the file, without the path and without the suffix ".DOCX". If the document has just been created, its name was built by Word.

 

 

Example

 

Creates a new document in a widened and visible window.

 

CHGVAR

VAR(&CMD) VALUE('WDOCUMENT')

CHGVAR

VAR(&PARM1) VALUE(' ')

CHGVAR

VAR(&PARM2) VALUE('VISIBLE;MAXIMIZE;NEW')

CALL

PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 &PARM2 &RESULT)

MONMSG

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

  

Opens Rapport.docx document, reading only, in a reduced window.

 

CHGVAR

VAR(&CMD) VALUE('WDOCUMENT')

CHGVAR

VAR(&PARM1) VALUE('C:\temp\Rapport.docx')

CHGVAR

VAR(&PARM2) VALUE('VISIBLE;MINIMIZE;READONLY')

CALL

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

&PARM2 &RESULT)

MONMSG

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

 

 

See also

 

WORDOPEN

WNEWFILE