使用FileSystemObject导入文本 [英] Importing text using the FileSystemObject

查看:52
本文介绍了使用FileSystemObject导入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个带有一列txt文件名的电子表格。我正在尝试使用VBA将文件从每个文件导入到相邻的单元格,到目前为止没有运气。我的VBA技能非常基础,所以任何帮助都会非常感激。


谢谢

解决方案

imranolas,

到目前为止您尝试过哪些代码?你得到错误或者没有得到想要的结果吗?


twinnyfo,


我玩过filesystemobject并设法拉文本从单个文件到单个单元格。但是,我只是有点卡住我将所有文本文件拉到相关单元格。


我试图让它像下面的函数一样工作,但我希望我有点天真。

展开 | 选择 | Wrap | 行号


上面的代码是否成功?你的文本文件有多大,或者它们相对较小?


我知道可以在Excel中的特定单元格中插入值,那么到目前为止你尝试了什么?

Hi,

I have a spreadsheet with a column of txt filenames. I''m trying to import the text from each file to the adjacent cell using VBA, so far without luck. My VBA skills are very basic, so any help would be greatly appreciated.

Thanks

解决方案

imranolas,

What code have you tried so far? Are you getting errors or just not the desired results?


twinnyfo,

I''ve played with the filesystemobject and managed to pull the text from a single file to a single cell. However, I''m just a little stuck with how I would pull all text files to their relevant cells.

I tried to make it work as a function as below, but I expect I was being a little naive.

Expand|Select|Wrap|Line Numbers


Was the code above successful? How big are your text files, or are they relatively small?

I know it is possible to insert values into particluar cells in Excel, so what have you tried so far?


这篇关于使用FileSystemObject导入文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆