- ©«¤l
- 4
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp
- ³nÅ骩¥»
- sp3
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- »O¤¤
- µù¥U®É¶¡
- 2012-2-24
- ³Ì«áµn¿ý
- 2014-3-27
|
[µo°Ý] ¤å¦rÀÉ¥HÂл\©Î¶K¤W¤è¦¡¶×¤JEXCEL«ü©wÄæ¦ì
½Ð°Ýn±N¤å¦rÀɤº®e¶×¤J¦Ü«ü©wÄæ¦ì¤¤¡A¦]«ü©wÄæ¦ì¬Ò¦³¹ïÀ³pºâ¤½¦¡¡A¬G»Ýn¥H¶K¤W©ÎÂл\ªº¤è¦¡¶×¤J¦Ó¤£¬O¥H´¡¤J¤è¦¡¶×¤J¸ê®Æ¡]³o¼Ë«áÄòpºâ¤½¦¡·|¶Ã±¼¡^¡A½Ð°Ý¤U±¤º®en¦p¦ó×§ï¤~¯à¹F¦¨©O¡H¡H- Sub OpenFile()
- Dim strFilt As String
- Dim strTitle As String
- Dim strFname As Variant
- Dim i As Integer
- Dim strMsg As String
- strFilt = "¤å¦rÀÉ®×,*.txt,"
- strTitle = "¥´¶}Excel¤å¥ó"
- strFname = Application.GetOpenFilename(FileFilter:=strFilt, Title:=strTitle, MultiSelect:=True)
- If Not IsArray(strFname) Then
- MsgBox "¨S¿ï¾Ü¤å¥ó¡I"
- Else
- For i = LBound(strFname) To UBound(strFname)
- strMsg = strMsg & strFname(i) & vbCrLf
- With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & strFname(i), Destination:=Range("$S$2"))
- .Name = "18"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = False
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .TextFilePromptOnRefresh = False
- .TextFilePlatform = 950
- .TextFileStartRow = 1
- .TextFileParseType = xlDelimited
- .TextFileTextQualifier = xlTextQualifierDoubleQuote
- .TextFileConsecutiveDelimiter = False
- .TextFileTabDelimiter = True
- .TextFileSemicolonDelimiter = False
- .TextFileCommaDelimiter = False
- .TextFileSpaceDelimiter = False
- .TextFileColumnDataTypes = Array(1, 1)
- .TextFileFixedColumnWidths = Array(14)
- .TextFileTrailingMinusNumbers = True
- .Refresh BackgroundQuery:=False
- Columns("S:AG").Select
- Range("S2").Activate
- Selection.ColumnWidth = 3
- End With
- Next
- MsgBox "¿ï¾Üªº¤å¥ó¬O¡G" & vbCrLf & strMsg
- End If
- End Sub
½Æ»s¥N½X |
|