<< Click to Display Table of Contents >> Navigation: 3. Script Language > Browser and Office (Acc.-Engine) > OFC. - Office-Commands > MS-Excel Scripting > OFC. - Office-Commands |
MiniRobotLanguage (MRL)
OFC.Excel|SAVE
SAVE MS-Excel worksheet via the SPR
Intention
Generally you will need to OPEN a Excel-Instance first, this is done using the "OPEN" Subcommand.
To SAVE your Excel-Worksheet, use the SAVE Subcommand.
There is one Parameter, that will force Excel to suppress any Error-Messages like "File exists" etc.
Set the Force Flag to "1" if you want Excel to Save your Files anyway (if possible with the given name and path).
The Command will drop an "1" on the TOS if it was successful, otherwise a "0".
Syntax:
OFC.Excel|SAVE[|P1]
Parameter Explanation:
P1 - 0/1 - FORCE Flag suppress Error-Messages and force Excel to SAVE even if the file already exists
Example:
' Excel SAVE Example
VAR.$$PFA=?path\Test5.xls
' Open New empty Sheet
OFC.excel|OPEN||0|1
' Activate by name
OFC.excel|SHEET_Activate|2
' Save as Filename
OFC.excel|SAVEAS|$$PFA
MBX.!
' Write some numbers into Sheet
OFC.excel|FORMULA|A1:B10|2
' SAVE
OFC.excel|SAVE
' Show Stack
DMP.6
MBX.Click to Close
OFC.excel|CLOSE|1
END.
Remarks:
To Close your Excel-Instance, use the CLOSE Subcommand.
However, its not necessary to close an Excel File, if you want to leave it open, even after the SPR exits.
Limitations:
These commands need an valid Installation of MS-Office Excel. It will check if MS Excel is properly installed, and if not just do nothing.
The SAVE Subcommand will only work with Excel-Instances that have previously been opened with the OPEN Subcommand of the same Robot-Instance.
If the command succeeds, it will drop an "1" on the TOS.
See also: