- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
§A¦n¡G
½Ð¥ý¸Õ¸Õ¬O§_¥i¦æ
Sub tt()
'½Ð¥ý³]©w¤Þ¥ÎMicrosoft Scripting Runtime
Dim mFso As Scripting.FileSystemObject
Dim mTxt As Scripting.TextStream
Dim mStr As String
Dim mPath$, mFile$
Dim ar(), ar1(), ar2()
Dim s%, s1 As Long, s2 As Long, m%, m1%, i%, j%
Dim mSplit
mPath = "C:\Documents and Settings\mine\My Documents\"
mFile = "SASÀÉÂàTXTÀɪºµ²ªG.txt"
Set mFso = CreateObject("Scripting.FileSystemObject")
Set mTxt = mFso.OpenTextFile(Filename:=mPath & mFile, IOMode:=ForReading)
With mTxt
Do Until .AtEndOfStream
mStr = .ReadLine
mSplit = Split(mStr)
For s = 0 To UBound(mSplit)
ReDim Preserve ar(s)
ar(s) = mSplit(m)
m = m + 1
Next
ReDim Preserve ar1(s1)
ar1(s1) = ar
s1 = s1 + 1
m = 0
Erase ar
If s1 > 65536 Then
ReDim Preserve ar2(s2)
ar2(s2) = ar1
s2 = s2 + 1
Erase ar1
s1 = 0
End If
Loop
.Close
End With
Erase ar1
s1 = 0
m1 = Worksheets.Count
For i = m1 + 1 To s2
Worksheets.Add
Next
For s1 = 0 To UBound(ar2)
Worksheets(s1 + 1).Range("a1").Resize(65536, 24) = Application.Transpose(Application.Transpose(ar2(s1)))
Next
Set mTxt = Nothing
Set mFso = Nothing
End Sub |
|