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

[µo°Ý] Function»yªk·Q­×§ï¥Î¦bExcel2007ª©

[µo°Ý] Function»yªk·Q­×§ï¥Î¦bExcel2007ª©

H¶Wª©, ¦U¦ì¤j¤j

¤p§Ì¦³­ÓÂÂExcel2003ÀÉ®×vba¨Ï¥ÎWith Application.FileSearchµLªk¥Î¦bExcel2007, »yªk¦p¤U

·Ð½Ð¥ý¶i«ü¾É¸Ó¦p¦ó­×§ï¤~¯à¨Ï¥Î©óExcel2007ª©

Public Function FilesPathFind(FindPath, FindFileName, Data)
Dim ss As SearchScope
Dim sf As ScopeFolder
Dim lngCount As Long

With Application.FileSearch
    .NewSearch
    .Filename = FindFileName
    .LookIn = FindPath
    .SearchSubFolders = True
    .FileType = msoFileTypeBinders
   
    If .Execute <> 0 Then
        Data = 1

    Else
        Data = 0
    End If
End With

End Function

¦^´_ 1# luke

¬Ý¤£À´§A³o­Ó¨ç¼Æªº§@¥Î
­Y­n­pºâÀÉ®×Ãþ«¬ªº¼Æ¶q¡A¸Õ¸Õ
  1. Public Function FilesPathFind(FindPath$, FindFileName$)
  2. Dim fs$
  3. fs = Dir(FindPath & FindFileName)
  4. Do Until fs = ""
  5.   FilesPathFind = FilesPathFind + 1
  6.   fs = Dir
  7. Loop
  8. End Function
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh


    H¶Wª©

    ¥ýÁÂÁ§AªºµªÂÐ

    ³o­Ó¥\¯à¨ç¼Æ¬OVBªº¥Î»y, ¤]¬O¤p§Ì©Ò´£¥h·f°t¨â­Ó¸ê®Æ§¨¶×¤J¬Û¦PÀɮצWºÙ, »Ý¶×¤J¦h¹F400­Ó¥H¤WÀÉ®×,
    ¨C¦¸¶×¤J¨â­Ó¦PÀɦW¦A°µ¤ÀÃþ³B²z, DATA§Q¥ÎComboBox©I¥s, ¤º³¡¨Ï¥Î¤j¶q¼È®É°O¾ÐÅé¾ã²z, ³Ì«á±o¨ì¬ù1¸U¸ê®Æ¦C

     ´ú¸Õ«á¤´µLªk§JªA°ÝÃD

     ¥H¤W

TOP

¦^´_ 3# luke


    §Aªº¨ç¼Æ¥\¯à¹ê¦bµLªk±qµ{¦¡½X¤¤²z¸Ñ
¾ãÅéµ{¦¡¹B§@¤£¥i¯à±q¤ù¬q¥BµLªk°õ¦æªºµ{¦¡¥h²q´ú§A­nªº¥\¯à
¥H§Aªº¨ç¼Æ¨Ó¬Ý
FilesPathFind³Ì«á­n¶Ç¦^ªº¬O¬Æ»òªF¦è?
Data¬O¤Þ¼Æ¡A¦ý§A«o­n¦b¨ç¼Æ°õ¦æ¤¤Åܧó¡A¤£ª¾¦³¦ó·N¸q?
¥H§Aªº¨ç¼Æµ{¦¡½X¸ÑÄÀ¦p¤U
¦bFindPath¸ê®Æ§¨¤º·j´M¦W¬°FindFileNameªº¤å¥ó§¨ÀÉ®×
¦pªG§ä¨ì´N±NData§ï¦¨1§_«h§ï¦¨0
³o¼ËªºÅÞ¿è¦ü¥G¬O¿ù»~ªº
©Ò¥H¥u¯à§i¶D§A³o¬O¿ù»~¡A¨ÃµLªk¬°§A¸Ñ¨M°ÝÃD
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# Hsieh


    ÁÂÁÂH¤j

    §Aªº§PÂ_¬O¹ïªº, ²{µ{¦¡¤w§@¦p¤U­×§ï«áOK

    fs = Dir(FindPath & "\" & FindFileName)
    If fs = "" Then
    FData = 0
    Else
    Data = 1

    ·PÁ¨ó§U

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD