xlSheetId

This function finds the sheet ID of a named sheet in order to construct external references.

Returns the sheet ID in pxRes->val.mref.idSheet.

Syntax

Excel4(xlSheetId, LPXLOPER pxRes, 1, LPXLOPER pxSheetName);

pxSheetName (xltypeStr)

The name of the book and sheet you want to find out about. This argument is optional; if omitted, xlSheetId returns the sheet ID of the active (front) sheet.

Remarks

The sheet must be open to use this function. There is no way to construct a reference to an unopened sheet from DLLs. For more information about using xlSheetId to construct references, see "Using Reference XLOPERs" on page 159.

Example

\SAMPLES\EXAMPLE\EXAMPLE.C

short WINAPI xlSheetIdExample(void)
{
    XLOPER xSheetName, xRes;

    xSheetName.xltype = xltypeStr;
    xSheetName.val.str = "\021[BOOK1.XLS]Sheet1"";
    Excel4(xlSheetId, &xRes, 1, (LPXLOPER)&xSheetName);
    Excel4(xlcAlert, 0, 1, TempNum(xRes.val.mref.idSheet));
    Excel4(xlFree, 0, 1, (LPXLOPER)&xRes);
    return 1;
}

Related Function

xlSheetNm