vb txt文本读取最后一行指定字符

2026-05-18 17:24:39
推荐回答(3个)
回答1:

Open 文件 For binary As #1
tmp=input(lof(1),1)
close#1
s=split(tmp,"|")
text1=s(ubound(s))

回答2:

Private Sub Command1_Click()
Dim i%, a$(1000)
Open App.Path + "\test.txt" For Input As #1
Do
Line Input #1, a(i)
i = i + 1
Loop Until EOF(1)
Close #1
Text1 = Right(a(i - 2), 1) & a(i - 1)
End Sub

回答3:

读取最后一行不就可以了?