WebTables 属性

       

向查询表中导入 Web 页时,返回或设置由逗号分隔的表格名称或表格索引号的列表。String 类型,可读写。

说明

只有当查询表的 QueryType 属性设置为 xlWebQuery、该查询返回一个 HTML 文档以及 WebSelectionType 属性值为 xlSpecifiedTables 时,才使用此属性。

示例

本示例在第一个工作簿中第一张工作表上添加一个新的 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