Condividi tramite


NamedRange.QueryTable Property

Definition

Gets a QueryTable that represents the query table that intersects the NamedRange control.

public:
 property Microsoft::Office::Interop::Excel::QueryTable ^ QueryTable { Microsoft::Office::Interop::Excel::QueryTable ^ get(); };
public Microsoft.Office.Interop.Excel.QueryTable QueryTable { get; }
member this.QueryTable : Microsoft.Office.Interop.Excel.QueryTable
Public ReadOnly Property QueryTable As QueryTable

Property Value

A QueryTable that represents the query table that intersects the NamedRange control.

Examples

The following code example uses the QueryTable property to refresh a query table that intersects a NamedRange. 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

Applies to