Top
PowerCOBOL V11.0 Reference
FUJITSU Software

5.59 NewBook Method

Description:

Executes the Excel new command to create a new book.

Starts Excel if Excel is not running.

Used in controls:

ExcelConnection

Used in objects:

None.

Parameters:

[VT_I4 SheetIndexS9(9) COMP-5]

Description of Parameters:

The index of the sheet to connect to within the Excel book. Data is exchanged with this sheet, however, the sheet is not selected in Excel.

Each sheet has a tab in Excel (by default labeled "Sheet1", "Sheet2", "Sheet3"). The index numbers the sheets from left to right 1, 2, 3...

Return value:

VT_I4 - ReturnValueS9(9) COMP-5

Zero or greater indicates normal completion.
Negative indicates an error.

Example:

WORKING-STORAGE SECTION.
01 ExcelSheetIndx PIC S9(9) COMP-5.
01 ReturnValue    PIC S9(9) COMP-5.
PROCEDURE DIVISION.
    MOVE 2 To ExcelSheetIndx
    INVOKE CmExcel1 "NewBook"
      USING     ExcelSheetIndex
      RETURNING ReturnValue

Backward compatibility
method name:

NEWEXCELSHEET

Backward compatibility
arguments:

None.