XLL+ Class Library (7.0)

CXlOper Class

Used to pass data from add-in functions to Excel.

class CXlOper


A CXlOper object encapsulates the XLOPER structure. This structure is used by the Excel SDK to pass data between Excel and add-in functions. Specifically, the XLOPER data type is used to pass data to and from Excel under the following circumstances:

  • Passing values which can contain various data types
  • Passing arrays
  • Passing optional arguments
  • Because Excel 2007 and earlier versions of Excel use different XLOPER structures, code that directly reads or writes the structure must be aware of which version of Excel it is using. The CXlOper class wraps these differences, so that you can ignore which version of Excel is being run.

    Data types

    The table below lists the data types supported by the CXlOper class.

    Type 'C' type Description
    xltypeNum double IEEE floating-point number (8 bytes)
    xltypeStr LPSTR Under Excel 2003 and below: an ASCII string (limited to 255 characters)
    xltypeStr LPWSTR Under Excel 2007 and above: a Unicode string (limited to 32,767 characters)
    xltypeBool BOOL Boolean
    xltypeErr WORD Error value. For a full list of error values, see the Error codes.
    xltypeInt short int Under Excel 2003 and below: a 16-bit integer
    xltypeInt int Under Excel 2007 and above: a 32-bit integer
    xltypeMulti array Array of XLOPERs
    xltypeSRef sref Reference to a single range of cells
    xltypeRef mref Reference to one or more ranges of cells

    COper class

    Under earlier versions of XLL+ (5 and below) the COper class was used as a simple way to pass array or optional arguments from Excel to add-in functions. The COper class has now been merged into CXlOper. The following line in the XLL+ header files redefines COper:

    typedef CXlOper COper;

    This allows existing code that uses the COper type to build without problems.

    Some methods of COper have not been implemented. Please see Breaking changes - COper methods for a list.

    CXlArray type

    See also Comparison of CXlOper and CXlArray types.


    Header: xllplus.h

    See Also

    CXlOper Methods | xllplus.h