Udostępnij za pośrednictwem


NamedRange.Errors Property (2007 System)

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

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Errors As Errors
'Usage
Dim instance As NamedRange 
Dim value As Errors 

value = instance.Errors
[BrowsableAttribute(false)]
public Errors Errors { get; }
[BrowsableAttribute(false)]
public:
property Errors^ Errors {
    Errors^ get ();
}
public function get Errors () : Errors

Property Value

Type: Errors
An Errors object that enables you to access error checking options.

Remarks

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

Examples

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.

Private errorsRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub CheckForErrors()
    errorsRange = Me.Controls.AddNamedRange(Me.Range("C3"), _
        "errorsRange")
    Me.errorsRange.Formula = "'12" 

    If Me.errorsRange.Errors( _
        Excel.XlErrorChecks.xlNumberAsText).Value Then
        MessageBox.Show("The number is written as text.")
    Else
        MessageBox.Show("The number is not written as text.")
    End If 
End Sub
Microsoft.Office.Tools.Excel.NamedRange errorsRange;
private void CheckForErrors()
{
    errorsRange = this.Controls.AddNamedRange(
        this.Range["C3", missing], "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.");
    }
}

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace