Returns a copy of one of the single references in a multiple reference
CXlRef GetRefItem( WORD wItem ) const; |
The index of the range to retrieve. The first item is at position 0.
Returns a copy of one of the single ranges in a multiple reference. If the CXlOper contains a single reference, and wItem is 0, then the function will return the single reference itself.
The function will throw an exception of type CXlBadOperTypeException if the object does not contain a single or multiple reference, or of type CXlOutOfRangeException if wItem is out of range.
Under XLL+ version 5 and below, this method returned a reference to the actual CXlRef contained within the CXlOper, which could then be written to directly. In order to support Excel 2007 as well as earlier versions of Excel, this functionality has had to be changed.
The method now returns a copy of the CXlRef contained in the CXlOper; in order to change its value, you must call SetRefItem to apply any changes. Thus, if your existing code is:
xloRef.GetRefItem(0).MoveBy(0, 1);
You will need to change it to:
CXlRef xlr = xloRef.GetRefItem(0); xlr.MoveBy(0, 1); xloRef.SetRefItem(0, xlr);
Alternatively, you can use the new short-hand function:
xloRef.MoveRefBy(0, 1);
CXlOper::GetCaller() Example | MyAddress Example
Header: xllplus.h
CXlOper Class | CXlOper Methods | CXlOper::GetRefCount() | CXlOper::SetRefItem()