| 发表于:2007-03-30 10:22:401楼 得分:0 |
请把下面代码放入一个按钮下试验一下 '把文本文件装入一个数组,每行为一个数组元素 open app.path & "\test.txt " for input as #1 dim strarray() as string dim i as long i = 0 dim strline as string do while not eof(1) ' 循环至文件尾。 input #1, strline redim preserve strarray(i) strarray(i) = strline i = i + 1 loop close #1 '替换第二行的878 strarray(1) = replace(strarray(1), "878 ", "999 ") '重写回test.txt文件 open app.path & "\test.txt " for output as #1 dim j as long for j = 0 to i - 1 print #1, strarray(j) next close #1 | | |
|