求VB一行生成一个文件的方法
比如A表
123
456
789
能批量生成三个文件吗?
123.txt
456.txt
789.txt
还比如
A表 B表
123 一二三
456 四五六
789 七八九
能生成每行一个文件,文件名为A表,内容为B表吗
我一点都不懂VB的,请教步骤是怎么做的?请教。。。
Private Sub Form_Load() Dim i As Integer, j As Integer, FileNum As Integer Dim File As String, TempString As String, TrgetPath As String TrgetPath = "C:\TMB\" i = 0: j = 0: File = "": TempString = "" For i = 1 To 100 File = TrgetPath & Format(i, "000") & "_" & Format(i + 1, "000") & "_" & Format(i + 2, "000") & ".txt" If i Mod 3 = 1 Then FileNum = FreeFile Open File For Output As #FileNum j = IIf(j > 25, j = 0, j) TempString = Chr(65 + j) & " " & Chr(65 + j + 1) & " " & Chr(65 + j + 2) j = j + 3 Print #FileNum, TempString TempString = "" Close #FileNum End If DoEvents Next i MsgBox "OK !" End Sub