第1个回答 推荐于2016-02-26
Private Sub Command1_Click()
Dim n As Integer, temp, filestr, abcstr, aa, bb, cc, a, b, c
Open "d:\m.txt" For Binary As #1
temp = StrConv(InputB(LOF(1), 1), vbUnicode) '把指定的文件全部读出来
Close #1
filestr = Split(temp, vbCrLf)
k:
n = Int(Val(Trim(InputBox("读取第几行?"))))
If n < 1 Or n > UBound(filestr) + 1 Then
MsgBox "输入错误!请重试!"
GoTo k
End If
abcstr = Split(filestr(n - 1), ",") '把指定的第n行全部读出来
aa = Trim(abcstr(0))
bb = Trim(abcstr(1))
cc = Trim(abcstr(2))
Rem 以下为获取a、b、c的数值
a = Val(Right(aa, Len(aa) - 2))
b = Val(Right(bb, Len(bb) - 2))
c = Val(Right(cc, Len(cc) - 2))
Print a, b, c
End Sub本回答被提问者采纳