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

返回或设置要导入到查询表中的文本文件的来源。Returns or sets the origin of the text file that you are importing into the query table. 该属性确定在数据导入过程中使用何种代码页。This property determines which code page is used during the data import. 读/写**XlPlatform**。Read/write XlPlatform.



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


默认值是在 “文本文件导入向导”“文件原始格式” 选项中的当前设置。The default value is the current setting of the File Origin option in the Text File Import Wizard.

仅当查询表基于文本文件中的数据 ( QueryType 属性设置为xlTextImport) 时, 才使用此属性。Use this property only when your query table is based on data from a text file (with the QueryType property set to xlTextImport).

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

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


本示例向第一个工作簿中第一张工作表上的查询表中导入一个 MS-DOS 文本文件,然后刷新该查询表。This example imports an MS-DOS text file into the query table on the first worksheet in the first workbook, and then it refreshes the query table.

Set shFirstQtr = Workbooks(1).Worksheets(1) 
Set qtQtrResults = shFirstQtr.QueryTables _ 
 .Add(Connection := "TEXT;C:\My Documents\19980331.txt", _ 
 Destination := shFirstQtr.Cells(1,1)) 
With qtQtrResults 
 .TextFilePlatform = xlMSDOS 
 .TextFileParseType = xlDelimited 
 .TextFileTabDelimiter = True 
End With

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