Private Sub Form_Load()
Dim FileNum As Long
Dim OutFile As Long
FileNum = FreeFile
InFileName = Dir("*.txt")
OutFileName = Left(InFileName, InStr(InFileName, ".") - 1) & "_C.[COLOR="Red"]txt1[/COLOR]"
Open InFileName For Input As FileNum
OutFile = FreeFile
Open OutFileName For Output As OutFile
First = True
Do While Not EOF(FileNum)
Input #FileNum, temp
temp = Trim(temp)
If Left(temp, 5) = "retlw" Then
num = Mid(temp, InStr(temp, "b"), 11)
If First Then
Print #OutFile, Chr(9) & "DB" & Chr(9) & num;
First = False
Else
Print #OutFile, "," & num
First = True
End If
End If
Loop
[COLOR="Red"]End[/COLOR]
End Sub