我正在尝试使用 VBA 在 Access 中读取文本文件。代码如下:
Open "C:\Test\test.txt" For Input As #1
Dim MyString as String
Dim x as integer
x = 0
For x = 0 to 100
Input #1, MyString
MsgBox MyString
Next x
所以这段代码的目的是遍历一个文本文件,逐行读取并打印出来。但是存在文本行超过 255 个字符的概率。有没有办法读取超过 255 个字符的行并将它们存储在 VBA 中?谢谢你。
编辑:文本文件示例
1110; TESTING ; 1111; TESTING2 ; 5; 999990981; 10-30-2011; 12-01-2011; 133370001; 133370001; 133370001; 133370001; 133370001; 133370001; 133370001; 133370001; 133370001; 133370001; 133370001; 133370001; F; 13371; 1; TEST1 ; 000000000; 133370001; 0; TEST ; TESTTES ; TEST ; 501; 10001; 0; 00001;
1112; TESTING ; 1113; TESTING2 ; 3; 999990982; 10-02-2011; 10-30-2011; 133370002; 133370002; 133370002; 133370002; 133370002; 133370002; 133370002; 133370002; 133370002; 133370002; 133370002; 133370002; F; 13372; 2; TEST2 ; 000000000; 133370002; 0; TEST1 ; TESTTESTT ; TES ; 502; 10002; 0; 00002;
1113; TESTING ; 1114; TESTING2 ; 21; 999990983; 03-01-2011; 10-02-2011; 133370003; 133370003; 133370003; 133370003; 133370003; 133370003; 133370003; 133370003; 133370003; 133370003; 133370003; 133370003; F; 13373; 3; TEST3 ; 000000000; 133370003; 0; TTESTTESTT ; TESTTESTTES ; TESTTES ; 503; 10003; 0; 00003;