NamedRange.QueryTable Property

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

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

Syntax

'Declaration
ReadOnly Property QueryTable As QueryTable
QueryTable QueryTable { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.QueryTable
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.

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
Microsoft.Office.Tools.Excel.NamedRange queryTableRange;
private void RefreshQueryTable()
{
    queryTableRange = this.Controls.AddNamedRange(
         this.Range["C1"], "queryTableRange");
    this.queryTableRange.QueryTable.Refresh(missing);
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace