<< 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|LastRow/LastColumn
Find out how much Rows/Columns are used 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.
Also you need to activate the sheet first using:
' Activate by Number
OFC.excel|SHEET_Activate|1
The Command will drop an "1" on the TOS if it was successful, otherwise a "0".
Syntax:
OFC.Excel|LastRow[|P1][|P2]
OFC.Excel|LastColumn[|P1][|P2]
Parameter Explanation:
P1 - (optional, Variable or "-") contains the variable that will receive the Result. The first Row/Column is "1" (1-based).
P2 - (optional, numeric) - Specify the Row(Column) number which is used to count the number of used Cells.
If sheets are not rectangular, means the headline is possibly larger then the rest of the sheet, you can specify where (in which row/column) to count.
Example:
' Excel LASTROW Example
OFC.excel|OPEN||0|1
DBP.---------------
' Activate by name
OFC.excel|SHEET_Activate|2
OFC.excel|write|A1:D1|54
OFC.excel|write|A2:C8|Hallo
OFC.Excel|LastRow|$$REA
OFC.Excel|LastColumn|$$REB
MBX.Last used Column $$REA $crlf$ Last used Row: $$REB
OFC.Excel|LastRow|$$REA|1
OFC.Excel|LastColumn|$$REB|1
MBX.Measured in Row 1 Last used Column $$REA $crlf$ Last used Row: $$REB
DMP.6
MBX.Click to Close
OFC.excel|CLOSE|1
END.
Remarks:
-
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 LASTROW/LASTCOLUMN 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: