Closes the active EXCEL workbook.
Syntax
CHGVAR VAR(&CMD)VALUE('XLCLOSEFILE')
CHGVAR VAR(&PARM1)VALUE('[*YES|*NO]')
CHGVAR VAR(&PARM2)VALUE(' ')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT +
&PARM1 &PARM2 &RESULT)
Parameters
Parameters |
|
Parm1 |
Save options: *YES: Saves modifications and closes the workbook. *NO: Closes the workbook without saving modifications.
If no option is chosen, an Office popup will appears : « Do you want to save modifications ? ». |
Parm2 |
|
Note 1 :
Be careful when you use the following command :
LNCCMD CMD(XLCLOSFILE) PARM1('*YES')
This command has to be used on workbook already save one time.
It should not be used on a new workbook because otherwise an Excel pop-up will open (if Launcher is in interactive mode) to ask to save the workbook.
Example :
LNCTOXLS TOXLS('C:\A\Templates\SPCUST_template.xls') FROMFILE(SP_CUST) TONAME(TABLEAU1) XLSMAP(*MAPNAME) SAVFMT(*NORMAL) ENDOPT(*NONE) SAVDOC(*NONE)
LNCCMD CMD(XLCELLS) PARM1('Ref="$C$11";Setvalue=true') PARM2('1')
LNCCMD CMD(XLCLOSFILE) PARM1('*YES')
After LNCTOXLS ENDOPT(*NONE) SAVDOC(*NONE), a new workbook, based on model, is created. After XLCLOSFILE *YES, there is this Excel popup (if Launcher is in interactive mode) to save the workbook:
Note 2 :
Be
careful if you use Excel in compatibility mode !
By default, the SAVFMT parameter of LNCTOXLS is equal to *NORMAL: the default
format of Excel. With Excel versions newer than 2003, the defaut format is
XLSX.
Example :
LNCTOXLS TOXLS('C:\A\Templates\SPCUST_template.xls') FROMFILE(SP_CUST) TONAME(TABLEAU1) XLSMAP(*MAPNAME) SAVDOC('c:\temp\res11233.xls') SAVFMT(*NORMAL) ENDOPT(*NONE)
LNCCMD CMD(XLCELLS) PARM1('Ref="$C$11";Setvalue=true') PARM2('1')
LNCCMD CMD(XLCLOSFILE) PARM1('*YES')
LNCCMD CMD(EXCELCLOSE)
The generated workbook will not be correct: the extension (.xls) and the format will not be homogeneous. Indeed the default format of Excel 2016 is .XLSX.
This is the Excel popup appearing when you open the generated workbook :
The right syntax is the following :
LNCTOXLS TOXLS('C:\A\Templates\SPCUST_template.xls') FROMFILE(SP_CUST) TONAME(TABLEAU1) XLSMAP(*MAPNAME) SAVDOC('c:\temp\res11233.xls') SAVFMT(*XLS) ENDOPT(*NONE)
LNCCMD CMD(XLCELLS) PARM1('Ref="$C$11";Setvalue=true') PARM2('1')
LNCCMD CMD(XLCLOSFILE) PARM1('*YES')
LNCCMD CMD(EXCELCLOSE)
See also
• XLSAVEAS