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

Opens an EXCEL Workbook.

 

The Excel application must first have been opened with EXCELOPEN.

 

Syntax 

CHGVAR

VAR(&CMD) VALUE('XLOPENFILE')

CHGVAR

VAR(&PARM1) VALUE('File path')

CHGVAR

VAR(&PARM2) VALUE('
[TEXT=True/False]
[;ReadOnly=True/False]
[;Visible=True/False]
[;New=True/False]
[;AddToWorkbook=True/False]
[;Name="Sheet name"]

[;PWD="password"]
')

CALL

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

&PARM2 &RESULT)

 

Paramètres

 

Parameters

 

Parm1

Path and name of the file to open. If only the file is specified, it will be opened in the default directory of EXCEL documents.

 

Parm2

Parm2 allows to set properties of for opening.

 

Properties :

Text: to open the file in text mode. The file must have the same format as the one created by LAUNCHER Office (CSV format).
The '* TEXT' option is also accepted for compatibility with older versions.

ReadOnly: to open the file read-only.
The option '*ONLY' is also accepted for compatibility with older versions.

AddToWorkbook: to add the read file to the current workbook, as a new sheet.
If no workbook is open, a new workbook is created.

Name: allows you to name the new worksheet if the AddToWorkbook option is also selected.

New: Creates a blank workbook.

Visible: makes the instance of Excel visible.


PWD
: A string that contains the password required to open a protected workbook. If this argument is omitted and the workbook requires a password, the user is prompted for the password.

 

Note

By specifying the Text option, LAUNCHER Office will check if there is a LFD file, which would have been created during the file transfer. This repeats the description of the AS/400 file to reproduce it in the workbook.

 

Examples

 

CHGVAR

VAR(&CMD) VALUE('XLOPENFILE')

CHGVAR

VAR(&PARM1) VALUE('%LNCDIR%\Docs\fichier.xlsx')

CHGVAR

VAR(&PARM2) VALUE(' ')

CALL

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

&PARM2 &RESULT)

 

In this example, the file will be opened from the Launcher installation directory.

 

CHGVAR

VAR(&CMD) VALUE('XLOPENFILE')

CHGVAR

VAR(&PARM1) VALUE(' ')

CHGVAR

VAR(&PARM2) VALUE('New;Visible')

CALL

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

&PARM2 &RESULT)

In this example, a new workbook will be created and made visible.

 

LNCCMD     CMD(EXCELOPEN)                                                                              

LNCCMD     CMD(XLOPENFILE) PARM1('C:\A\base.xlsx')

   

In this example, a workbook is opened after having created an instance of the Excel application.

 

LNCCMD     CMD(EXCELOPEN)                                                                               LNCCMD CMD(XLOPENFILE) PARM1('%TEMP%\LNC002.TXT') + PARM2('AddToWorkbook;Name="Customers"')

 

In the example above, the file "LNC002.TXT" is added to the current workbook as "Customers".

 

LNCCMD     CMD(EXCELOPEN)
LNCCMD CMD(XLOPENFILE) PARM1('C:\A\protected_workbook.xlsx') PARM2('PWD="aura"')                                                                         

In the example above, we open a protected workbook by specifying the password.

 

See also

XLCLOSFILE

XLSAVEAS