CALLER

Called from a DLL.

Returns information about the cell, range of cells, command on a menu, tool on a toolbar, or object that called the macro that is currently running.

Code called from

Returns

DLL

The Register ID.

A single cell

A cell reference.

Menu

A four-element array, containing the bar ID, the menu position, the submenu position, and the command position.

Toolbar

A two-element array. The first element is the toolbar number for built-in toolbars or a toolbar name for custom toolbars. The second item is the position on the toolbar.

Graphic object

The object identifier (object name).

ON.ENTER

A reference to the cell being entered.

ON.DOUBLECLICK

The cell that was double-clicked (not necessarily the active cell).

Auto_Open, AutoClose, Auto_Activate or Auto_Deactivate macro

The name of the calling sheet.

Other methods not listed

#REF! Error.


The return value is one of the following XLOPER data types: xltypeRef, xltypeSRef, xltypeNum, xltypeStr, xltypeErr, or xltypeMulti. For more information about XLOPERs, see "The XLOPER Data Type" on page 151.

Syntax

Excel4(xlfCaller, (LPXLOPER) pxRes,0);

Example

\SAMPLES\EXAMPLE\EXAMPLE.C

short WINAPI CallerExample(void)
{
    XLOPER xRes;

    Excel4(xlfCaller, (LPXLOPER)&xRes, 0);
    Excel4(xlcSelect, 0, 1, (LPXLOPER)&xRes);
    Excel4(xlFree, 0, 1, (LPXLOPER)&xRes);
    return 1;
}

Remarks

This function is the only exception to the rule that worksheet functions can be called only from DLLs that were called from worksheets.