XLL+ Class Library (7.0)


Returns a reference to an item in a one-dimensional array

CXlCell VectorCell(
   size_t szItem
const CXlConstCell VectorCell(
   size_t szItem
) const;



The row or column containing the item of interest (the top row and the leftmost column are 0).

Return Value

This function returns a reference to an item contained in a one-dimensional array.

If szItem is out of range then an exception of type CXlOutOfRangeException will be thrown.


The function should only be used for arrays containing one row or one column.

The reference returned by this function can be used to read the item or (if the CXlOper itself is writeable) to update it.

Breaking change

Under previous versions of XLL+ (5 and below), this method returned a reference to a CXlOper type, which was contained within the outer CXlOper. In order to support both Excel 2007 and older versions of Excel, this functionality has had to be changed.

The method now returns a new class of object, CXlCell or CXlConstCell, which can be used to refer to the cell, but is not itself of type CXlOper.

If your code retained a copy of the return value, as in for instance:

const CXlOper& item = xloArray.VectorCell(i);
total += item.ToDouble();

then it must be changed. The code above becomes:

CXlConstCell item = xloArray.VectorCell(i);
total += item.ToDouble();

If your code simply used the returned value without retaining a copy of it, then it will continue to compile. For example, the following code does not need to change:

xloArray.VectorCell(i) = 0.0;


CXlOper::VectorCell() Example


Header: xllplus.h

See Also

CXlOper Class | CXlOper Methods | CXlOper::GetVectorCount() | CXlOper::IsVector()