Expand Minimize

NamedRange.Errors Property

Gets an Errors object that enables you to access error checking options.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Errors Errors { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Errors
An Errors object that enables you to access error checking options.

Reference the Errors object to view a list of index values associated with error checking options.

The following code example creates a NamedRange and inserts a number written as text into the range, and then uses the Errors property to determine whether the number is written as text.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange errorsRange;
private void CheckForErrors()
{
    errorsRange = this.Controls.AddNamedRange(
        this.Range["C3"], "errorsRange");
    this.errorsRange.Formula = "'12";

    if (this.errorsRange.Errors[
        Excel.XlErrorChecks.xlNumberAsText].Value)
    {
        MessageBox.Show("The number is written as text.");
    }
    else
    {
        MessageBox.Show("The number is not written as text.");
    }
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft