Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 1.9 KB

Excel.QueryTable.WebTables.md

File metadata and controls

58 lines (36 loc) · 1.9 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
QueryTable.WebTables property (Excel)
vbaxl10.chm518124
vbaxl10.chm518124
Excel.QueryTable.WebTables
d60eb457-6276-2d86-bbd8-c2050b0695c9
05/03/2019
medium

QueryTable.WebTables property (Excel)

Returns or sets a comma-delimited list of table names or table index numbers when you import a webpage into a query table. Read/write String.

Syntax

expression.WebTables

expression A variable that represents a QueryTable object.

Remarks

Use this property only when the query table's QueryType property is set to xlWebQuery, the query returns an HTML document, and the value of the WebSelectionType property is xlSpecifiedTables.

If you import data by using the user interface, data from a web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data by using the object model, data from a web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebTables property applies only to QueryTable objects.

Example

This example adds a new web query table to the first worksheet in the first workbook, and then imports data from the first and second tables on the webpage.

Set shFirstQtr = Workbooks(1).Worksheets(1) 
Set qtQtrResults = shFirstQtr.QueryTables _ 
 .Add(Connection := "URL;https://datasvr/98q1/19980331.htm", _ 
 Destination := shFirstQtr.Cells(1,1)) 
With qtQtrResults 
 .WebFormatting = xlNone 
 .WebSelectionType = xlSpecifiedTables 
 .WebTables = "1,2" 
 .Refresh 
End With 

[!includeSupport and feedback]