共用方式為


WorkbookBase.DocumentInspectors 屬性

取得活頁簿的文件檢查模組集合。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

'宣告
Public ReadOnly Property DocumentInspectors As DocumentInspectors
    Get
public DocumentInspectors DocumentInspectors { get; }

屬性值

型別:Microsoft.Office.Core.DocumentInspectors
Microsoft.Office.Core.DocumentInspectors 集合,其中包含活頁簿的文件檢查模組。

範例

下列程式碼範例會逐一查看活頁簿中的偵測器。 程式碼會檢查每個偵測器,並顯示列出偵測器名稱和檢查狀態與結果的訊息方塊。

這是示範文件層級自訂的範例。

Private Sub GetDocumentInspectors()
    For Each insp As Office.DocumentInspector In Me.DocumentInspectors
        Dim status As Office.MsoDocInspectorStatus
        Dim results As String = String.Empty
        insp.Inspect(status, results)
        MessageBox.Show("Inspector Name: " + insp.Name + vbCrLf _
            + "Status: " + status.ToString() + vbCrLf + "Results: " _
            + results)
    Next
End Sub
private void GetDocumentInspectors()
{
    foreach (Office.DocumentInspector insp in this.DocumentInspectors)
    {
        Office.MsoDocInspectorStatus status;
        string results = String.Empty;
        insp.Inspect(out status, out results);
        MessageBox.Show("Inspector Name: " + insp.Name 
            + "\r\nStatus: " + status.ToString() + "\r\nResults: "
            + results);
    }
}

.NET Framework 安全性

請參閱

參考

WorkbookBase 類別

Microsoft.Office.Tools.Excel 命名空間