1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| Private Sub Command1_Click()
Dim xdata(20000, 14)
Dim sdata(1500, 10)
Dim Textline1
Dim Textline2
Open file1 For Input As #1
sn = 1
While Not EOF(1)
sn = sn + 1
Line Input #1, Textline2
sdata(sn, 1) = Mid$(Textline2, 2, 3)
sdata(sn, 2) = (Mid$(Textline2, 20, 4))
sdata(sn, 3) = Val(Mid$(Textline2, 26, 1))
sdata(sn, 4) = Mid$(Textline2, 27, 2)
sdata(sn, 5) = Val(Mid$(Textline2, 48, 8))
sdata(sn, 6) = Val(Mid$(Textline2, 57, 9))
sdata(sn, 7) = Val(Mid$(Textline2, 66, 6))
sdata(sn, 8) = Val(Mid$(Textline2, 72, 3))
sdata(sn, 9) = (Mid$(Textline2, 75, 6))
sdata(sn, 10) = sdata(sn, 1) * 10000 + sdata(sn, 2)
scheck = sdata(sn, 1) * 10000 + sdata(sn, 2)
Wend
MsgBox "Nb de ligne: " & sn
Close 1
Open file2 For Input As #2
xn = 1
While Not EOF(2)
xn = xn + 1
Line Input #2, Textline1
xdata(xn, 1) = Val(Mid$(Textline1, 2, 3))
xdata(xn, 2) = Val(Mid$(Textline1, 8, 4))
xdata(xn, 3) = Val(Mid$(Textline1, 12, 1)) '
xdata(xn, 4) = Val(Mid$(Textline1, 13, 1)) '
xdata(xn, 5) = Val(Mid$(Textline1, 14, 4)) '
xdata(xn, 6) = Val(Mid$(Textline1, 32, 4)) '
xdata(xn, 7) = Val(Mid$(Textline1, 38, 1)) '
xdata(xn, 8) = Val(Mid$(Textline1, 39, 4)) '
xdata(xn, 9) = Val(Mid$(Textline1, 43, 4)) '
xdata(xn, 10) = Val(Mid$(Textline1, 47, 1)) '
xdata(xn, 11) = Val(Mid$(Textline1, 48, 4)) '
xdata(xn, 12) = Val(Mid$(Textline1, 67, 4)) '
xdata(xn, 13) = Val(Mid$(Textline1, 76, 4)) '
xdata(xn, 14) = Val(Mid$(Textline1, 80, 1)) '
xcheck = xdata(xn, 5) * 1000 + xdata(xn, 6)
Wend
MsgBox "Nb de ligne: " & xn
Close 2 |
Partager