VB如何生成多个txt文件呢??

来源:百度知道 编辑:UC知道 时间:2024/05/24 10:36:05
我写了一个

Dim r As Long
Open 1.txt For Append As #1
Print #1, 文件1
Close
如何从1排列 比如生成1.txt到100.txt呢?生成多个文件
这个我也搜索到过 我是要
生成1.txt到100.txt

我要的是VB 请不会的不要发言!

DIM A AS INTEGER
FOR A=0 TO 100
OPEN "C:\" & A & ".TXT" FOR APPEND AS #1
PRINT #1, "FILE " & A
CLOSE #1
NEXT A

function writetxt (filename as string,currenttxt as string)
filename ="c:\" & filename & ".txt"
'filename要生成的文件名 currenttxt当前写入的文件内容.
open filename for output As #1
print #1, currenttxt
close #1
end functiong

sub xxx
...
'定义rs为recorder,并生成记录集,
...
rs.movefirst
while not rs.eof
call writetxt rs.filds("文章标题").value ,rs.filds("文章").value
rs.movenext
loop
'关闭记录集等
end sub

批处理很容易