Private Sub Command1_Click() Dim i, arr, temp, s, brr() As Double Open "e:\c材料\20120125-1\10mv.txt" For Input As #1 arr = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbNewLine) Close #1 For i = 0 To UBound(arr) If IsNumeric(Left(arr(i), 1)) And InStr(arr(i), ",") > 0 And InStr(arr(i), "e-") > 0 Then temp = Split(arr(i), ",") If UBound(temp) = 1 Then s = s & arr(i) & vbNewLine End If End If Next If Len(s) > 0 Then s = Split(Left(s, Len(s) - 1), vbNewLine) ReDim brr(UBound(s), 1) For i = 0 To UBound(s) brr(i, 0) = Split(s(i), ",")(0): Print brr(i, 0) brr(i, 1) = Split(s(i), ",")(1): Print brr(i, 1) Next End If End Sub
缠绵不楚
2024-05-19 11:21:25
是读取txt文件,还是text里的文本
自动识别有多少行,保存在x()一维数组中
Dim x() Private Sub Command1_Click() Open "e:\c材料\20120125-1\10mv.txt" For Input As 3 Do Until EOF(1) Line Input #1, a t = Split(a, ",") If IsNumeric(t(0)) = True Then n = n + 1 ReDim Preserve x(n) x(n) = a End If Loop Close End Sub