TextFileOtherDelimiter 属性

       

返回或设置在向查询表中导入文本文件时作为分隔符使用的字符。默认值为 NullString 类型,可读写。

说明

只有当查询表是基于文本文件中的数据(QueryType 属性设置为 xlTextImport)且 TextFileParseType 属性值为 xlDelimited 时,才使用本属性。

如果在字符串中指定了多个字符,则只使用第一个字符。

示例

本示例将第一个工作簿中第一张工作表上的查询表的分隔符设置为井号 (#),然后刷新该查询表。

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
    .TextFileParseType = xlDelimited
    .TextFileOtherDelimiter = "#"
    .Refresh
End With