Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.53 KB

Excel.ListObject.QueryTable.md

File metadata and controls

56 lines (36 loc) · 1.53 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
ListObject.QueryTable property (Excel)
vbaxl10.chm734089
vbaxl10.chm734089
Excel.ListObject.QueryTable
fe019d61-654a-9c87-0bf4-30590a1274ca
04/30/2019
medium

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

[!includeSupport and feedback]