OFC. - Office-Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Browser and Office (Acc.-Engine) > OFC. - Office-Commands > MS-Excel Scripting >

OFC. - Office-Commands

OFC. - Office-Commands/MS-Excel Scripting      

Previous Top Next


 

MiniRobotLanguage (MRL)

 

OFC.Excel|WRITE

Write to a Cell in an 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 WRITE Command wiill just put Text and Numbers into the Sheet. It will not place Formulas there.

Use the FORMULA-Command for that.

 

The Command will drop an "1" on the TOS if it was successful, otherwise a "0".

 

 

Syntax:

 

OFC.Excel|WRITE|P1|P2[|P3]

 

 

Parameter Explanation:

 

P1 - RANGE, A1:A1 oder A1:B400 specifies the coordinates of the cells to be written to.

P2 - Text, this text is written in the cells. Delimiter can be used (P3).

P3 - (opt./numeric) 0/1/2/3 - Which delimiters are evaluated.

    0 - no delimiters are evaluated, just write one Cell

    1 -  use Row-Delimiter (default = ",")

    2 -  use Column-Delimiter (default = ";")

 

Example:

 

' Excel WRITE Example

OFC.excel|OPEN||0|1

' Activate by name

OFC.excel|SHEET_Activate|2

OFC.excel|WRITE|B1:F8|23,44;+A1*2,=+A2*2|1

OFC.excel|WRITE|B9:F9|55,-6;8,+A2*2|2

OFC.excel|WRITE|B12:e19|55,-6;8,+A2*2|1

 

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:

The WRITE Command will just put Text and Numbers into the Sheet. It will not place Formulas there.

Use the FORMULA-Command for that.

 

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 WRITE 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:

 

  !Excel-Scripting

  Excel_Open

  Excel_Exist