FindRangeByName

 

Description

Find a named range

Syntax

int FindRangeByName( LPCSTR lpcszName, string * pStrRange, bool bProjOnly = true, DataRange * pdr = NULL )

Parameters

lpcszName
[input] range name
pStrRange
[output] range string if found
bProjOnly
[input] if true will only find project level named range
pdr
[input] range if found

Return

-1 if not found, otherwise return the scope 0=sheet, 1=book, 2=project

Examples

EX1

void FindRangeByName_ex(string strName)
{
        DataRange dr;
        FindRangeByName(strName, NULL, false, &dr);
        if(dr)
        {
                string strRange;
                dr.GetRangeString(strRange, NTYPE_SHORT_NAME_ONLY|NTYPE_ALWAYS_SHOW_COLUMN);
                out_str(strRange);
        }
        else
                out_str("not found");
}

Remark

See Also

RangeName

header to Include

origin.h

Reference