The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

QueryTables Collection Object [Excel 2003 VBA Language Reference]

Office 2003
Multiple objects

A collection of QueryTable objects. Each QueryTable object represents a worksheet table built from data returned from an external data source.

Using the QueryTables Collection

Use the QueryTables property to return the QueryTables collection. The following example displays the number of query tables on the active worksheet.

MsgBox ActiveSheet.QueryTables.Count

Use the Add method to create a new query table and add it to the QueryTables collection. The following example creates a new query table.

Dim qt As QueryTable
sqlstring = "select 96Sales.totals from 96Sales where profit < 5"
connstring = _
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
        Destination:=Range("B1"), Sql:=sqlstring)
End With

Methods | Add Method | Item Method

Parent Objects | Worksheet

Child Objects | ListObject | Parameters | Range