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

如果将 ODBC 连接字符串中的密码信息与指定查询一起保存,则为 TrueTrue if password information in an ODBC connection string is saved with the specified query. 如果删除密码,则为 FalseFalse if the password is removed. 读取/写入 BooleanRead/write Boolean.

语法Syntax

表达式SavePasswordexpression.SavePassword

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

说明Remarks

此属性由数据透视表和查询表在 ODBC 和 OLE DB 查询中使用。This property is used in both ODBC and OLE DB queries, and by both PivotTables and QueryTables.

如果使用用户界面导入数据, 则会将来自 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.

您可以使用ListObject的查询表属性来访问SavePassword属性。 You can use the QueryTable property of the ListObject to access the SavePassword property.

如果 ListObject 已连接到 SharePoint 列表,此属性将被忽略。This property is ignored if the ListObject is connected to a SharePoint list.

示例Example

此示例在每次保存查询表一时,都不保存 ODBC 连接字符串的密码信息。This example causes password information to be removed from the ODBC connection string whenever query table one is saved.

Worksheets(1).QueryTables(1).SavePassword = False

支持和反馈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.