XmlMappedRange.Errors 属性

获取一个 Errors 对象,使用该对象可以访问 XmlMappedRange 控件的错误检查选项。

命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)

语法

声明
ReadOnly Property Errors As Errors
    Get
Errors Errors { get; }

属性值

类型:Microsoft.Office.Interop.Excel.Errors
一个 Errors 对象,使用该对象可以访问 XmlMappedRange 控件的错误检查选项。

备注

引用 Errors 对象以查看与错误检查选项相关联的索引值的列表。

示例

下面的代码示例将作为文本写入的数字插入 XmlMappedRange 中,然后使用 Errors 属性确定该数字是否作为文本写入。 此代码示例假定当前工作表包含一个名为 CustomerLastNameCell 的 XmlMappedRange

Private Sub CheckForErrors()
    Me.CustomerLastNameCell.Formula = "'12"

    If Me.CustomerLastNameCell.Errors( _
        Excel.XlErrorChecks.xlNumberAsText).Value Then
        MsgBox("The number is written as text.")
    Else
        MsgBox("The number is not written as text.")
    End If
End Sub
private void CheckForErrors()
{
    this.CustomerLastNameCell.Formula = "'12";

    if (this.CustomerLastNameCell.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 安全性

请参见

参考

XmlMappedRange 接口

Microsoft.Office.Tools.Excel 命名空间