xlfGetDef

Office 2013 and later

Last modified: April 20, 2012

Applies to: Excel 2013 | Office 2013 | Visual Studio

Returns the name, as text, that is defined for a particular area, value, or formula in a workbook. In Excel, this value is displayed in the Name column of the Name Manager dialog box, which is displayed when you click Name Manager in the Defined Names section on the Formulas tab. Use xlfGetDef to get the name that corresponds to a definition. To get the definition of a name, use xlfGetName.

Excel12(xlfGetDef, LPXLOPER12 pxRes, 3, LPXLOPER12 pxDefText, LPXLOPER12 pxDocumentText, LPXLOPER12 pxTypeNum);

pxDefText (xltypeStr)

Can be anything you can define a name to refer to, including a reference, a value, an object, or a formula.

References must be given in R1C1 style, such as "R3C5". If pxDefText is a value or formula, it is not necessary to include the equal sign that is displayed in the Refers To column in the Name Manager dialog box. If there is more than one name for pxDefText, xlfGetDef returns the first name. If no name matches pxDefText, xlfGetDef returns the #NAME? error value.

pxDocumentText (xltypeStr)

Specifies the sheet that pxDefText is on. If pxDocumentText is omitted, it is assumed to be the active sheet.

pxTypeNum (xltypeNum)

A number from 1 to 3 specifying which types of names are returned.

pxTypeNum

Returns

1 or omitted

Normal names only.

2

Hidden names only.

3

All names.

pxRes (xltypeStr or xltypeErr)

Returns the name associated with the specified definition.

The following table lists four examples of the values returned by a call to xlfGetDef with the specified arguments.

Name defined in Excel

pxDefText

pxDocumentText

pxTypeNum

Value Returned

The specified range in Sheet4 is named Sales.

"R2C2:R9C6"

"Sheet4"

<omitted>

"Sales"

The value 100 in Sheet4 is defined as Constant.

"100"

"Sheet4"

<omitted>

"Constant"

The specified formula in Sheet4 is named SumTotal.

"SUM(R1C1:R10C1)"

"Sheet4"

<omitted>

"SumTotal"

3 is defined as the hidden name Counter on the active sheet.

"3"

<omitted>

2

"Counter"

Show: