- ©«¤l
- 6
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 6
- ÂI¦W
- 0
- §@·~¨t²Î
- window xp
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-10-8
- ³Ì«áµn¿ý
- 2013-11-28
|
¦^´_ 3# wj1228.518
Sub ¶×¤J¤å¦rÀÉ()
Dim MySht As Worksheet, uFile, ShtName, xSht As Worksheet, i&
Set MySht = Sheets("TEMP")
Application.ScreenUpdating = False
ShtName = Array("0", "430", "630", "1040", "1050", "2050", "3050")
'---------------------------------------
For i = 0 To UBound(ShtName)
uFile = ThisWorkbook.Path & "\" & ShtName(i) & ".txt"
If Dir(uFile) = "" Then GoTo NEXT_FILE
'----------------------------------------
For Each xSht In Sheets
If xSht.Name = ShtName(i) Then
Application.DisplayAlerts = False
xSht.Delete
Application.DisplayAlerts = True
End If
Next
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = ShtName(i)
'-----------------------------------------
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & uFile, Destination:=Range("A1"))
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 950
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(8, 9, 11, 8, 5, 11, 11, 8, 8, 10)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
.Delete
End With
NEXT_FILE:
Next
'-------------------------------------------------------
MySht.Select
Application.ScreenUpdating = True
MsgBox "¡ã¡ã¶×¤J§¹¦¨¡ã¡ã¡@"
End Sub |
|