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

[µo°Ý] ¶W³sµ² vba

[µo°Ý] ¶W³sµ² vba

¨D±Ï¤@¤U¦U¦ì¥ý¶i... ¤½¥q¦³­ÓÁ`ªí,¤W­±¦³©Ò¦³±ÄÁʳ渹½X(¦p¤U¹Ï J1710 ), ©Ò¦³­q³æ¸¹½X³£¬O«e­±©T©w¤­­Ó¦r, «á­±«h¬O¤£©T©w. ¯à§_¤@¦¸©ÊÅýEXCEL¥h§ì ¬Y­Ó¸ê®Æ§¨¸Ì­±ªº©Ò¦³±ÄÁʳæ³sµ², ¥B¤¤¶¡ÁÙ¦³¤@¼h¸ê®Æ§¨ (ex.±ÄÁÊ->«~µP->±ÄÁʳ渹½X) ?
¤p§Ì¦bª¦¤åªº®É­Ô§ä¨ì¤@±øvbaªº¶W³sµ²,·Q»¡­×§ï¤@¤UÀ³¸Ó¥i¥H®M¥Î, ¦ý¤@ª½¤£¦¨¥\(¹Ï¤ù¤wªþ).  ¤p§Ì¤~Á¡²¨²L,ÁÙ±æ¦U¦ì¥ý¶iÀ°À°¦£. ¦b¦¹Á¹L.
Jason

¥»©«³Ì«á¥Ñ adrian_9832 ©ó 2017-11-27 14:46 ½s¿è

®Ú¾Ú³o¸Ì¥H©¹«e ½úªº¸gÅç©Ò¤À¨É : excel 2003 ªº¤è¦V ¦pªG¥Îexcel 2003¥H¤Wªº ¥i¯à­n§ä¤@¤U¤è¦¡;¦]¬° excel 2003¥H¤W ªº³£§âfilesearch ¤ÓºÊ¤F ¦n¹³´«¤F§Oªº¤è¦¡!
1: ¥ý·j´MexcelªºÀÉ®×  ---> 2. ¦A§@¸ê®Æ¤Wªº³B²z  (©Îª½±µ¦b±½´yªº¤º®e¥Î¤Wmid ¨ÓŪ¨úÀɦW;³o­Ó¨S¸Õ¹L)  ©Î ¥Î left ªº¤è¦¡ÅªÀY5­Ó¦ì
sub test ()
    With Application.FileSearch
    ref = Range("y18")
        .NewSearch
        .LookIn = "path"   '<---§Aªº¸ô®|
        .SearchSubFolders = True
        .Filename = "*.xls" '<---§A­n§äªºÀÉ®×Ãþ«¬
        .FileType = msoFileTypeExcelWorkbooks
        If .Execute() > 0 Then
        For I = 1 To .FoundFiles.Count
        On Error Resume Next
        Cells(I, 3) = .FoundFiles(I)
        Next I
        Else
        MsgBox "Folder " & sFolder & " contains no required files"
        End If
    End With
end sub

TOP

¦^´_ 2# adrian_9832

AD¥S,·PÁ±z¼·¤¾¦^´_.  ¤p§Ì®M¥Î¤W¥hÅã¥Ü°õ¦æ¿ù»~'445'.ª«¥ó¤£¤ä´©¦¹°Ê§@.  

Sub test()
    With Application.FileSearch
    ref = Range("y18")
        .NewSearch
        .LookIn = "\\192.168.5.5\Public\¦@¨ÉÀÉ®×\2018 CS\"   '<---§Aªº¸ô®|
        .SearchSubFolders = True
        .Filename = "*.xls" '<---§A­n§äªºÀÉ®×Ãþ«¬
        .FileType = msoFileTypeExcelWorkbooks
        If .Execute() > 0 Then
        For I = 1 To .FoundFiles.Count
        On Error Resume Next
        Cells(I, 3) = .FoundFiles(I)
        Next I
        Else
        MsgBox "Folder " & sFolder & " contains no required files"
        End If
    End With
End Sub
Jason

TOP

¥»©«³Ì«á¥Ñ adrian_9832 ©ó 2017-11-27 23:02 ½s¿è

¦pªG§A¥ÎEXCEL 2003  ¥Î¥H¤Wªº¤èªk¬O¨S°ÝÃDªº  

¦ý¦pªG§A¥Î2003¥H¤Wªºª©¥»  ¥i¯à­n¥ÎDIR ¤~¥i¥H¸Ñ¨M°ÝÃD  ¹ï©óDIR §Ú¥u·|¦b¤å¥ó§¨¤ºÅª  ¤l¥Ø¿ý¤ºªº¤åÀÉŪ¤£¥X¨Ó   §A¸Õ¸Õ³o­Ó§a ¬O¥H«e³o­Ó½×¾Âªº«e½ú±Ð¤U¨Óªº¤è¦¡   

Sub ¦C¥XÀÉ®×()
path1 = "C:\Users\Desktop\test\·s¼W¸ê®Æ§¨\*.xls"
file1 = Dir(path1): r = 1
i = 1

Do While file1 <> ""
  Cells(r, 1) = file1
  r = r + 1
  file1 = Dir '¨ú±o¤U¤@­ÓÀɦW
Loop



Do Until Cells(i, 1) = ""
If Cells(i, 1) <> Empty Then
    Cells(i, 1) = Left(Cells(i, 1), 2)        '<------2¥Nªí§A­n®³ÀɮצW   ±q¥ªÃä°_¦h¤Ö­Ó¦r  
i = i + 1
End If
Loop


End Sub



¸Ô²Ó¥i¥H°Ñ¦Ò³o¦ì«e½ú ¹ï©ó search¤l¥Ø¿ý ªº³o½g©«¤l
http://forum.twbts.com/thread-40-1-1.html

TOP

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD