vba 如何将制表符分隔的文本文件导入 Excel?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9129142/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 12:31:33  来源:igfitidea点击:

How to import Tab delimited Text files into Excel?

excel-vbavbaexcel

提问by user1049518

I have multiple text files (.txt) with Tab delimited in a folder. The text file contains first line as column headings. I have one pre defined excel template with column names. I am able to import the text files into excel template. But, what i need to do is how to delimit if the column heading not match with Excel column headings Through VBA. Thanks in advance for any help .....

我有多个文本文件 (.txt),在一个文件夹中用 Tab 分隔。文本文件包含第一行作为列标题。我有一个带有列名的预定义 excel 模板。我能够将文本文件导入到 excel 模板中。但是,我需要做的是如何通过 VBA 分隔列标题是否与 Excel 列标题不匹配。在此先感谢您的帮助.....

回答by DerDee

It's possible to do it in Excel itself, in Office 2010 its in the Data tab > Text to columns. There you can select that its delimited by tabs, and there you go, your data should be columnised

可以在 Excel 本身中执行此操作,在 Office 2010 中的数据选项卡 > 文本到列中。在那里你可以选择它由制表符分隔,然后你的数据应该被列化