Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xlref->rwLast : 65535 = 16383 ???

1 view
Skip to first unread message

Laurent Longre

unread,
Jul 16, 1998, 3:00:00 AM7/16/98
to
[Excel 97 SR-1]

I'm using xltypeSRef and xltypeRef XLOPER arguments in add-in functions, and I am stuck
on the following problem: when I pass the reference of one or more entire columns (like
A:A, C:F) to the function, the corresponding XLOPER holds truncated references, ie the
first 16384 rows (A1:A16384, C1:F16384, etc.). 16384 was the maximal number of rows in
Excel 5/95, but now it is 65536, and the function should get references like A1:A65536.

This problem occurs only when I use entire columns. References like A1:A65535 or
A2:A65536 are stored properly in the XLOPER.

Here is a short test function:

extern "C" __declspec(dllexport) LPXLOPER WINAPI Test(LPXLOPER pxRange){
static XLOPER xRet;
switch(pxRange->xltype){
case xltypeSRef:
xRet.val.num=pxRange->val.sref.ref.rwLast;
break;
case xltypeRef:
xRet.val.num=pxRange->val.mref.lpmref->reftbl->rwLast;
break;
default:
xRet.xltype=xltypeErr;
xRet.val.err=xlerrRef;
return &xRet;
}
xRet.xltype=xltypeNum;
return &xRet;
}

The returned value is (last row of pxRange)-1, since the fields of xlref are based on 0.

Results :

=TEST(A25000) returns 24999 (OK)
=TEST(B150:E3901) returns 3900 (OK)
=TEST(C2:C65536) returns 65535 (OK)
=TEST(B1:B16384) returns 16383 (OK)

=TEST(C:C) returns 16383 => **FALSE, should return 65535**

I've tested xlfRows with A:A and A1:A16384 and... both return 65536 (!?!?!?!)

"xlfRows(A1:A16383)" => 16383 (OK)
"xlfRows(A1:A16384)" => 65536 (FALSE)
"xlfRows(A1:A16385)" => 16385 (OK)

It means not only that functions based on xltypeSRef or xltypeRef can't use references
of entire rows, but also that they are unable to make a difference between X1:X16384 and
X:X, which have both exactly the same xlref.

Is this a known bug, and how could I fix it ?

Best regards,

Laurent

0 new messages