- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 221
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-10-10
|
¦^´_ 3# metrostar - Sub test()
- Dim fs, ar, fn$, br(1 To 10000, 1 To 7), t
- Dim c, i&, j&, r&, ph$
- ph = ThisWorkbook.Path & "\" 'Àɮץؿý
- c = Array(0, 0, 1, 2, 3, 4, 5, 7)
- fs = Application.GetOpenFilename("Text Files (*.txt), *.txt", , , , True)
- If Not IsArray(fs) Then MsgBox "¨S¦³¿ï¨úÀÉ®× !!!": Exit Sub
- With CreateObject("vbscript.regexp")
- .Global = True
- .Pattern = " +(?!$)"
- s = LBound(fs)
- While s <= UBound(fs)
- Open fs(s) For Input As #1
- ar = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
- Reset
- For i = 4 To UBound(ar) - 1
- r = r + 1
- ar(i) = .Replace(ar(i), "|")
- t = Split(ar(i), "|")
- For j = 1 To UBound(c)
- br(r, j) = t(c(j))
- Next
- br(r, 2) = Mid(Replace(fs(s), ph, ""), 6, 8)
- Next
- Close #1
- s = s + 1
- Wend
- End With
- With Sheets("Sheet2")
- .Range("2:" & Rows.Count).ClearContents
- .Range("a:a").NumberFormatLocal = "@"
- If r > 0 Then .[a2].Resize(r, UBound(br, 2)) = br
- End With
- End Sub
½Æ»s¥N½X |
|