Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 2.07 KB

Excel.QueryTable.WebSelectionType.md

File metadata and controls

59 lines (37 loc) · 2.07 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
QueryTable.WebSelectionType property (Excel)
vbaxl10.chm518122
vbaxl10.chm518122
Excel.QueryTable.WebSelectionType
f0068811-96f8-55c6-a18d-29af4ae3a0e2
05/03/2019
medium

QueryTable.WebSelectionType property (Excel)

Returns or sets a value that determines whether an entire webpage, all tables on the webpage, or only specific tables on the webpage are imported into a query table. Read/write XlWebSelectionType.

Syntax

expression.WebSelectionType

expression A variable that represents a QueryTable object.

Remarks

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

If the value of this property is xlSpecifiedTables, you can use the WebTables property to specify the tables to be imported.

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 WebSelectionType 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]