VB 读取并输出到文件
各位大神,我想问一下,要用VB读取中间这一列(14:41这一列)并输出到文件,语句该怎么写啊?求指导!...
各位大神,我想问一下,要用VB读取中间这一列(14:41 这一列)并输出到文件,语句该怎么写啊?求指导!
展开
1个回答
展开全部
你把文本贴上来,才能保证一次成功。
要不把下面的程序试一下?
Private Sub Command1_Click()
Open "d:\1.txt" For Input As #1
Open "d:\2.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, a
a = " 2013 14:41 NaN"
i = 1
Do While Mid(a, i, 1) < "0"
i = i + 1
Loop
Do While Mid(a, i, 1) >= "0"
i = i + 1
Loop
Do While Mid(a, i, 1) < "0"
i = i + 1
Loop
For j = 1 To 5
Print #2, Mid(a, i, 1);
i = i + 1
Next j
Print #2,
Loop
Close #1
Close #2
End Sub
要不把下面的程序试一下?
Private Sub Command1_Click()
Open "d:\1.txt" For Input As #1
Open "d:\2.txt" For Output As #2
Do While Not EOF(1)
Line Input #1, a
a = " 2013 14:41 NaN"
i = 1
Do While Mid(a, i, 1) < "0"
i = i + 1
Loop
Do While Mid(a, i, 1) >= "0"
i = i + 1
Loop
Do While Mid(a, i, 1) < "0"
i = i + 1
Loop
For j = 1 To 5
Print #2, Mid(a, i, 1);
i = i + 1
Next j
Print #2,
Loop
Close #1
Close #2
End Sub
更多追问追答
追问
2013 14:41 NaN
2013 15:41 92.24
2013 16:41 92.21
2013 17:41 92.18
2013 18:41 92.46
2013 19:41 92.36
2013 20:41 92.33
追答
程序已经贴上了。
d:\1.txt是原来的文件,
d:\2.txt是输出文件。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询