NamedRange.QueryTable 屬性

定義

取得 QueryTable,表示與 NamedRange 控制項相交的查詢資料表。Gets a QueryTable that represents the query table that intersects the NamedRange control.

public Microsoft.Office.Interop.Excel.QueryTable QueryTable { get; }

屬性值

QueryTable

QueryTable 表示與 NamedRange 控制項相交的查詢資料表。A QueryTable that represents the query table that intersects the NamedRange control.

範例

下列程式碼範例會使用 QueryTable 屬性來重新整理與相交的查詢資料表 NamedRangeThe following code example uses the QueryTable property to refresh a query table that intersects a NamedRange. 這個程式碼範例假設工作表包含相交于儲存格 C1 的查詢資料表。This code example assumes that the worksheet contains a query table that intersects cell C1.

這個範例適用于檔層級自訂。This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange queryTableRange;
private void RefreshQueryTable()
{
    queryTableRange = this.Controls.AddNamedRange(
         this.Range["C1"], "queryTableRange");
    this.queryTableRange.QueryTable.Refresh(missing);
}
Private queryTableRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub RefreshQueryTable()
    queryTableRange = Me.Controls.AddNamedRange( _
        Me.Range("C1"), "queryTableRange")
    Me.queryTableRange.QueryTable.Refresh()
End Sub

適用於