EditWebPage 属性 (Excel)QueryTable.EditWebPage property (Excel)

返回或设置 web 查询的网页统一资源定位器 (URL)。Returns or sets the webpage Uniform Resource Locator (URL) for a web query. 读/写 VariantRead/write Variant.



_表达式_一个代表查询表对象**** 的变量。expression A variable that represents a QueryTable object.


如果 EditWebPage 属性没有设置,则返回 nullThe EditWebPage property returns null if not set. 只有当查询类型为 Web 或 OLE 时,EditWebPage 属性才有意义。The EditWebPage property is only meaningful if the query type is Web or OLE.

如果EditWebPage不为null, 则忽略**WebTables** 属性进行刷新。If the EditWebPage is not null, ignore the WebTables property for refreshing. 因此, XML 查询和WebTables属性引用原始网页中的表, 应仅在编辑用例中使用, 才能预先填充 " Web 查询" 对话框。As a result, an XML query and the WebTables property refers to the table in the original webpage and should only be used in the edit case to pre-populate the Web Query dialog box.

如果使用用户界面导入数据, 则会将来自 web 查询或文本查询的数据作为一个查询表**** 对象导入, 而将所有其他外部数据作为**ListObject** 对象导入。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.

如果使用对象模型导入数据, 则必须将来自 web 查询或文本查询的数据作为查询表导入****, 而所有其他外部数据均可作为ListObject或查询表导入。 ****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.

EditWebPage 属性只应用于 QueryTable 对象。The EditWebPage property applies only to QueryTable objects.


在此示例中, Microsoft Excel 向用户显示网页 URL。In this example, Microsoft Excel displays to the user a webpage URL. 本示例假定活动**** 工作表上的单元格 A1 中存在一个查询表对象, 并且在 C:\ 上存在一个名为 MyHomepage 的文件。驱动器.This example assumes a QueryTable object in cell A1 exists on the active worksheet and that a file called MyHomepage.htm exists on the C:\ drive.

Sub ReturnURL() 
 ' Set the EditWebPage property to a source. 
 Range("A1").QueryTable.EditWebPage = "C:\MyHomepage.htm" 
 ' Display the source to the user. 
 MsgBox Range("A1").QueryTable.EditWebPage 
End Sub

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.