回复 2楼 风吹过b
好象没有达到我要的效果,
我想要的是按照CSV表格,三个数据 分别生成于三列中,如:
13002 | 2 | 0 |
但是现在的结果是,三个数据都位于第一列中,如:
| 13002 2 0 |
我的原程序代码如下,需要修改的为代码中的红色部分
Private Sub Command1_Click()
Dim Num As Long
Dim NewNum As Long
Dim i As Integer
Dim Tmp() As String
Num = FreeFile
Open "原文件.txt" For Input As #Num
Do While Not EOF(Num)
Line Input #Num, tmpstr
Tmp() = Split(tmpstr, " ")
NewNum = FreeFile
Select Case Tmp(0)
Case Is = 13001, 13003, 13004
If Dir(Trim(Tmp(0)) & ".txt") <> "" Then
Open App.Path & "\" & "air" & Trim(Tmp(0)) & -3 & ".csv" For Append As #NewNum
Else
Open App.Path & "\" & "air" & Trim(Tmp(0)) & -3 & ".csv" For Append As #NewNum
End If
Print #NewNum, Tmp(0), 10, Tmp(1)
Case Else
If Dir(Trim(Tmp(0)) & ".txt") <> "" Then
Open App.Path & "\" & "air" & Trim(Tmp(0)) & -3 & ".csv" For Append As #NewNum
Else
Open App.Path & "\" & "air" & Trim(Tmp(0)) & -3 & ".csv" For Append As #NewNum
End If
Print #NewNum, Tmp(0), 10, Tmp(1)
End Select
Close #NewNum
Loop
Close #Num
End Sub