3.7.5.11 Excel

LabTalk Object Type:

Utility Object

The excel object provides script access for running Excel macros and invoking Visual Basic application functions.

Methods:

Method Description
excel.run(functionName, Arg1, Arg2, ..., Arg5)

Run a Visual Basic application function from Origin. You must supply the correct number of arguments with this method. The method can accept up to five arguments. The workbook containing the Visual Basic application function must be active. FunctionName is the Visual Basic application function.

excel.runRange(sheetName, RangeName, Arg1, Arg2, ..., Arg5)

Run a macro from Origin. You must supply the correct number of arguments with this method. The method can accept up to five arguments. The workbook containing the macro must be active. SheetName is the name of the sheet containing the macro. Rangename is the name of the cell on the sheet where the macro starts (for example, C6)

Note:

The excel.runRange() method was designed for older versions of Excel macros that were actually included as part of a spreadsheet in a particular cell or range. (Since Excel 5, macros have become VBA code and old-style macros can't be created in new versions of Excel.)

Examples:

excel.runRange(SheetName,ExcelRange)

which will activate SheetName and select ExcelRange.

For example:

 
excel.runRange(Sheet2,A12:F25);

will activate Sheet2 of the (active) Excel workbook and select columns A through F and rows 12 through 25.

New style macros can be run with the excel.run() method.