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

[µo°Ý] ¦bExcel 2003¿ý»sªº¥¨¶°¡A¦bExcel2007/2010«oµo¥Í°õ¦æ¿ù»~'9' or '445'

[µo°Ý] ¦bExcel 2003¿ý»sªº¥¨¶°¡A¦bExcel2007/2010«oµo¥Í°õ¦æ¿ù»~'9' or '445'

¥H¤U¬O§Ú¦bExcel 2003
  1. Sub Get_TEXT()

  2. Dim MyBook, LinkBook As Workbook, _
  3.     MySht, LinkSht, BaSht, WorkSht As Worksheet, _
  4.     MyPath, FindFile, FileCunt, x, Xm As Long, _
  5.     RngEnd As Range, uDate As Date

  6. Set FindFile = Application.FileSearch

  7. With FindFile
  8.     .LookIn = MyPath: .Filename = "*.csv"
  9.     .SearchSubFolders = False: .MatchTextExactly = True
  10.     .FileType = msoFileTypeAllFiles
  11.     FileCunt = .Execute()
  12. End With

  13. If FileCunt = 0 Then _
  14.    MsgBox "¡°§ä¤£¨ì­n¶×¤Jªº¤å¦rÀÉ!!! ", 0 + 48, ">>´£¥Ü°T®§": Exit Sub
  15. Application.ScreenUpdating = False

  16. '...
  17. End Sub
½Æ»s¥N½X
¦ý¦bExcel 2007/2010«oµo¥Í°õ¦æ¿ù»~¡Abug¬O¥X²{¦b¦P¤@¦æ
  1. Set FindFile = Application.FileSearch
½Æ»s¥N½X
¤£ª¾¹D¦bExcel 2007/2010®É¡A¦¹¦æ­n¦p¦ó­×§ï¡H
waterful.tw

¦^´_ 1# waterful.tw


    FileSearch
©ó2007ª©¥»¥H«á¤w¸g¤£¤ä´©¦¹ª«¥ó
¥i¨Ï¥ÎDir¨ç¼Æ©Î¬OGetOpenFilename¨Ó¨ú¥N
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

½Ð°ÝHsieh¤j¤j¡A­Y§Ú±N­ì¥ýµ{¦¡½X
  1. Set FindFile = Application.FileSearch
  2. With FindFile
  3.     .LookIn = MyPath: .Filename = "*.csv"
  4.     .SearchSubFolders = False: .MatchTextExactly = True
  5.     .FileType = msoFileTypeAllFiles
  6.     FileCunt = .Execute()
  7. End With
½Æ»s¥N½X
§ï¬°¤U¦Cµ{¦¡½X
  1. Set FindFile = Dir(MyPath & "*.csv")
  2. Do While FindFile <> ""
  3.     FileCunt = FileCunt + 1
  4.     FindFile = Dir
  5. Loop
½Æ»s¥N½X
¦bDir¨ç¼Æ³]©wªº¨º¦æ¡A«oµo¥Í"¦¹³B»Ý­nª«¥ó (¿ù»~ 424)"¿ù»~¡A½Ð°Ý§Ú¸Ó¦p¦ó­×§ï¡H
PS.¤£¤Ó·|¥ÎDir¨ç¼Æªº·s¤â¯d
waterful.tw

TOP

¦^´_ 3# waterful.tw
FindFile¬O¦r¦ê¤£¬Oª«¥ó¤£¯à¨Ï¥ÎSET³¯­z¦¡
  1. FindFile = Dir(MyPath & "*.csv")
  2. Do While FindFile <> ""
  3.     FileCunt = FileCunt + 1
  4.     FindFile = Dir
  5. Loop
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

·PÁÂHsieh¤j¤j¡A¬Ý¨Ó§Ú«á­±¦³¤@¤j¬qµ{¦¡­n­×§ï¤F¡Aµ¥¦³°ÝÃD¦b¤W¨Óµo°ÝÅo~ ^^
waterful.tw

TOP

        ÀR«ä¦Û¦b : ¦³®É·í«äµL®É­W¡A¦n¤Ñ­n¿n«B¨Ó³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD