- ©«¤l
- 2833
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2889
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-17
|
¦^´_ 3# ¦¶¤l
Sub ¶×¤J()
Dim xFile$, TxtStr$, T$, TR, Arr, i&, N&
Intersect(ActiveSheet.UsedRange, [A:G]).Offset(1, 0).EntireRow.Delete
xFile = ThisWorkbook.Path & "\data2.txt"
With CreateObject("ADODB.Stream")
.Charset = "UTF-8"
.Open
.LoadFromFile xFile
TxtStr = .ReadText
.Close
End With
TR = Split(TxtStr, vbCrLf)
ReDim Arr(1 To UBound(TR), 1 To 7)
For i = 0 To UBound(TR)
If Len(TR(i)) < 2 Then GoTo 101
If Left(TR(i), 6) = "¼Ð ·Ç §O¡G" Then T = Mid(TR(i), 7): GoTo 101
If T = "" Then GoTo 101
N = N + 1
TR(i) = Replace(TR(i), """", "|")
Arr(N, 1) = T '¼Ð·Ç§O
Arr(N, 2) = Trim(Evaluate("MidB(""" & TR(i) & """, 1, 10)")) '³B¸m¥N½X
Arr(N, 3) = Replace(Trim(Evaluate("MidB(""" & TR(i) & """, 11, 30)")), "|", """") '³B¸m¦WºÙ
Arr(N, 4) = Trim(Evaluate("MidB(""" & TR(i) & """, 41, 10)")) '¦¨¥»¤¤¤ß
Arr(N, 5) = Trim(Evaluate("MidB(""" & TR(i) & """, 51, 10)")) '³B¸mÃþ§O
Arr(N, 6) = Trim(Evaluate("MidB(""" & TR(i) & """, 61, 10)")) '°·«O³æ»ù
Arr(N, 7) = Trim(Evaluate("MidB(""" & TR(i) & """, 71, 10)")) '¦Û¶O³æ»ù
101: Next i
If N > 0 Then [A2].Resize(N, 7) = Arr
End Sub
'=============================== |
|