给你一个参考程序。测试正常。朋友
Option Base 1
'运行程序前,先在D盘上创建test和test_new两个文件夹
Private Sub Command1_Click() '创建五个.txt文件存放于test中
Dim a%(5, 5), k%, f%
For f = 1 To 5
Open "d:/test/" & f & ".txt" For Output As #f
For i = 1 To 5
For j = 1 To 5
k = k + 1
a(i, j) = k: Print #f, a(i, j) & " ";
Next j
Print #f, vbCr
Next i
Next f
Close
End Sub
Private Sub Command2_Click() '产生25个新.txt文件存放于test_new中
Dim a%(5, 6), b$, k%, m%, f%, q%, r%
Me.Cls
For k = 1 To 5
For m = 1 To 5
For f = 1 To 5
Open "d:/test/" & f & ".txt" For Input As #f
For q = 1 To 5
If Not EOF(f) Then
Input #f, a(q, 1), a(q, 2), a(q, 3), a(q, 4), a(q, 5), a(q, 6)
End If
Next q
Close
b = b & " " & a(k, m)
Next f
Print b '结果同时输出到窗体
r = r + 1
Open "d:/test_new/" & r & ".txt" For Output As r
Print #r, b
Close
b = ""
Next m
Next k
End Sub
温馨提示:内容为网友见解,仅供参考