Article ID: 166287
Article Last Modified on 10/12/2007
/*********
* RangeContainsText
*
* Purpose: Determine if a XLOPER reference points to a range that
* contains any cells containing text. Microsoft Excel 97
* stops responding if XlCoerce is used to convert a
* reference to a string.
*
* Parameter:
* pxRange[in] Range to check.
*
* Return: TRUE - Range contains text, or Excel4 call fails.
* FALSE - Range does not contain text and it is safe to
* use XlCoerce on the reference as a workaround
* to the problem.
*
*******************************************************************/
BOOL RangeContainsText(LPXLOPER pxRange)
{
DWORD dwRet = 0;
XLOPER xIsText;
BOOL bRet = TRUE; // Value returned if Excel4 Fails
// Check determine whether you are working with a range
if( !((xltypeSRef | xltypeRef) & (pxRange->xltype)))
return bRet;
dwRet = Excel4(xlfIstext,&xIsText,1,pxRange);
if( xlretSuccess == dwRet && xltypeErr != xIsText.xltype)
{
XLOPER xRet;
dwRet = Excel4(xlfOr,&xRet,1,&xIsText);
if( xlretSuccess == dwRet && xltypeBool == xRet.xltype)
bRet = xRet.val.bool;
}
Excel4(xlFree,0,1,&xIsText);
return bRet;
}
172475 How to obtain and install Microsoft Office 97 SR-1
Additional query words: sr1 crash 97 xldk xlsdk Excel4 Excel FIX
Keywords: kbbug kbdtacode kberrmsg kbfix kbprogramming KB166287