'楼上的代码,当文件最后有空行时会下标越界。
Dim Lines As String
Dim NextLine As String
Dim i As Integer
Open "d:\1.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, NextLine
Text1 = Text1 & Mid(NextLine, 1, 11) & vbCrLf
Text2 = Text2 & Mid(NextLine, 13, 8) & vbCrLf
Text3 = Text3 & Mid(NextLine, 22, 2) & vbCrLf
Loop
Close #1
dim tmptxt as string ,tmpstr() as string
dim i as integer
open "d:\1.txt" for input as #1
tmptxt=strconv(inputb(lof(1),#1),vbunicode)
close #1
tmpstr=split(tmptxt,vbcrlf)
for i=0 to ubound(tmpstr)
text1=text1 & split(tmpstr(i),"-")(0) & vbcrlf
text2=text2 & split(tmpstr(i),"-")(1) & vbcrlf
text3=text3 & split(tmpstr(i),"-")(2) & vbcrlf
next i
这个可以把一行读出来,然后按“-”分割成三部分,最后把每一行的各个部分连起来