Office 2013 and later

Last modified: April 20, 2012

Applies to: Excel 2013 | Office 2013 | Visual Studio

Returns the definition of a name as it appears in the Refers to column of the Name Manager dialog box, which is displayed when you click Name Manager in the Defined Names section on the Formulas tab. If the definition contains references, they are given as R1C1-style references. Use xlfGetName to check the value defined by a name. To get the name that corresponds to a definition, use xlfGetDef.

Excel12(xlfGetName, LPXLOPER12 pxRes, 2, LPXLOPER12 pxNameText, LPXLOPER12 pxInfoType);

pxNameText (xltypeStr)

Can be a name defined on the sheet; an external reference to a name defined on the active workbook, for example, "!Sales"; or an external reference to a name defined on a particular open workbook, for example, "[Book1]SHEET1!Sales". pxNameText can also be a hidden name.

pxInfoType (xltypeBool)

Specifies the type of information to return about the name. If FALSE or omitted, the definition is returned. If TRUE, returns TRUE if the name is defined for just the sheet, FALSE if the name is defined for the entire workbook.

pxRes (xltypeStr, xltypeBool, or xltypeErr)

Depending on the value passed for pxInfoType, returns the definition of the specified name (xltypeStr), or TRUE or FALSE (xltypeBool).

If the Protect worksheet and contents of locked cells check box has been selected in the Protect Sheet dialog box to protect the workbook containing the name, xlfGetName returns the #N/A error value. To see the Protect Sheet dialog box, click Protect Sheet in the Changes section of the Review tab.

The following table lists three examples of the values returned by a call to xlfGetDef with the specified pxNameText argument.

Definition in Excel


Value Returned

The name Sales on a sheet is defined as the number 523.



The name Profit on the active sheet is defined as the formula =Sales-Costs.



The name Database on the active sheet is defined as the range A1:F500.