帮忙更改VBS

来源:百度知道 编辑:UC知道 时间:2024/09/23 11:59:36
Set FSO=CreateObject("Scripting.FileSystemObject")
Set f=FSO.OpenTextFile("结果.txt",2,True)
For i=0001 To 9999
f.WriteLine "20712" & i & ""
Next
f.Close
Set f=Nothing
Set FSO=Nothing
这段VB 是我在网上找的 我不会VB 不知道为什么出来后 没有207120001 只有207121 求大家帮忙看下 或者再帮忙写一个

Set FSO=CreateObject("Scripting.FileSystemObject")
Set f=FSO.createTextFile("结果.txt",2)
For i=0001 To 9999
a=i
k=0
if a<10 then
a="000"&a
k=1
end if
if a<100 and k=0 then
a="00"&a
k=1
end if
if a<1000 and k=0 then
a="0"&a
end if
f.WriteLine "20712"&a
Next
f.Close

就可以了。

这样也行:
Set FSO=CreateObject("Scripting.FileSystemObject")
Set f=FSO.createTextFile("结果.txt",2)
For i=0001 To 9999
if i<10 then
i="000"&i
else
if i<100 then
i="00"&i
else
if i<1000 then
i="0"&i
end if
end if
end if
f.WriteLine "20712"&i
Next
f.Close

'简单修改一下就可以。
Set FSO=CreateObject("Scripting.FileSystemObject")
Set f=FSO.OpenTextFile("结果