Muokkaa

Jaa


ListObject.QueryTable property (Excel)

Returns the QueryTable object that provides a link for the ListObject object to the list server. Read-only.

Syntax

expression.QueryTable

expression A variable that represents a ListObject object.

Example

The following example creates a connection to a SharePoint site and publishes the ListObject object named List1 to the server. A reference to the QueryTable object for the list object is created, and the MaintainConnection property of the QueryTable object is set to True so that the connection to the SharePoint site is maintained between trips to the server.

Dim wrksht As Worksheet 
 Dim objListObj As ListObject 
 Dim objQryTbl As QueryTable 
 Dim prpQryProp As pro 
 Dim arTarget(4) As String 
 Dim strSTSConnection As String 
 
 Set wrksht = ActiveWorkbook.Worksheets("Sheet1") 
 Set objListObj = wrksht.ListObjects(1) 
 
 arTarget(0) = "0" 
 arTarget(1) = "https://myteam/project1" 
 arTarget(2) = "1" 
 arTarget(3) = "List1" 
 
 strSTSConnection = objListObj.Publish(arTarget, True) 
 
 Set objQryTbl = objListObj.QueryTable 
 
 objQryTbl.MaintainConnection = True

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.