使用VBA处理多个文本文件

时间:2014-07-16 16:17:31

标签: vba excel-vba excel

VBA新手......有一种更有效的方法可以做到这一点但是目前我拿一个文本文件然后把它读成一个字符串然后在字符串中搜索3个不同的东西,然后将它们插入到单元格中Excel中。

单个Excel文件:

 Dim myFile As String
 Dim text As String
 Dim textline As String
 Dim posGrade As Integer
 Dim posDelay As Integer
 Dim posIntersection As Integer

 myFile = "test.txt"

 Open myFile For Input As #1
 Do Until EOF(1)
     Line Input #1, textline
     text = text & textline
 Loop
 Close #1   

然后我搜索text以找到我想要的内容。我想要做的是能够为目录中的任意数量的文本文件执行此操作。有什么帮助吗?

0 个答案:

没有答案