XLL+ Class Library (7.0)


Transform an Excel value of unknown type to a CLR object

System::Object^ toClrObject(
   const CXlOperBase& xloValue,
   const wchar_t* argName



A single value received from Excel. This can be a single cell value, or a cell contained in an array value.

Note: if this value is specified as a parameter of the add-in function, it must be of type "Value", and not type "Reference". If the parameter has been passed as type "Reference", then the value must be extracted, using CXlOper::Coerce().


The name of the argument that is being converted. This will be used in error messages.

Return Value

A CLR object, that may be passed directly to a .NET method, using C++/CLI. If the input cell is empty, then null will be returned.


If the function fails for any reason, an exception of type CXlConversionException is thrown. This will be caught by the outer wrapper function, and converted into an appropriate form to be returned to Excel.


Header: xlpclrconvert.h

See Also

Common Language Runtime support functions | toClr | toClrObjectVector | toClrObjectMatrix