ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¦p¦ó§ó§ïVBªº³sµ²Àɮ׸ô®|

¦^´_ 1# v60i
¥Î¸ê®Æ§¨¹ï¸Ü¤è¶ôµ²ªG¨ú¥NThisWorkbook.Path
  1. Sub ¶×¤J¤å¦rÀÉ()
  2. Dim xFile, uFile, uHead As Range, Jm&, Km&, X, xT, xL
  3. Range("A:A").Clear '²M°£Â¶פJ¸ê®Æ
  4. '-----------------------------------------------------
  5. With Application.FileDialog(msoFileDialogFolderPicker)
  6. .Show
  7. fd = .SelectedItems(1)
  8. End With

  9. Application.ScreenUpdating = False
  10. Do
  11.     If xChk = 0 Then
  12.        xFile = Dir(fd & "\*.txt")
  13.        If xFile = "" Then MsgBox "¡°§ä¤£¨ì TXT ÀɮסI¡@", 0 + 16: Exit Sub
  14.        xChk = 1
  15.     Else
  16.        xFile = Dir
  17.        If xFile = "" Then Exit Do
  18.     End If
  19.     '----------------------------------------------
  20.     uFile = fd & "\" & xFile
  21.     Set uHead = Range("A65536").End(xlUp)
  22.     If uHead <> "" Then Set uHead = uHead(3, 1)
  23.     With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & uFile, Destination:=uHead)
  24.          .AdjustColumnWidth = False
  25.          .TextFileColumnDataTypes = Array(1)
  26.          .Refresh BackgroundQuery:=False
  27.          .Delete
  28.     End With
  29.     uHead.Interior.ColorIndex = 6
  30.     '¨Cµ§²Ä¤@®æ¥[¡e¶À¦â¡f©³
  31. NEXT_LINE:
  32. Loop
  33. '-------------------------------------------------------
  34. Application.ScreenUpdating = True
  35. MsgBox "¡ã¡ã¶×¤J§¹¦¨¡ã¡ã¡@"
  36. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¡i°±º¢¤£«e¡A²×µL©Ò±o¡j¤H³£°g©ó´M§ä©_ÂÝ¡A¦]¦Ó°±º¢¤£«e¡FÁa¨Ï®É¶¡¦A¦h¡B¸ô¦Aªø¡A¤]¤FµL¥Î³B¡A²×µL©Ò±o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD