返回或设置一个值,用于确定是否向查询表中导入了整个 Web 页、Web 页上的所有表格或 Web 页上的特定表格。XlWebSelectionType 类型,可读写。
XlWebSelectionType 可为以下 XlWebSelectionType 常量之一。 |
xlEntirePage |
xlAllTables 默认值。 |
xlSpecifiedTables |
expression.WebSelectionType
expression 必需。该表达式返回“应用于”列表中的对象之一。
只有当查询表的 QueryType 属性设置为 xlWebQuery 且该查询返回一个 HTML 文档时,才使用本属性。
如果本属性的值为 xlSpecifiedTables,则可以使用 WebTables 属性指定要导入的表格。
本示例在第一个工作簿中第一张工作表上添加一个新的 Web 查询表,然后导入 Web 页中第一个和第二个表格中的数据。
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
.Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
.WebFormatting = xlNone
.WebSelectionType = xlSpecifiedTables
.WebTables = "1,2"
.Refresh
End With