|
Public dicPictuce As Object
Public dicnc As Object
Public sPath
Sub GetFiles(ByVal sPath$)
Set dicPictuce = CreateObject("scripting.dictionary")
Set dicnc = CreateObject("scripting.dictionary")
With Application.FileSearch
.NewSearch
.LookIn = ThisWorkbook.Path
.SearchSubFolders = True
.Filename = "*.NC"
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Y = .FoundFiles(i)
d = InStrRev(Y, "\")
FNAME = Mid(Y, d + 1, 999)
If Not dicnc.Exists(FNAME) Then dicnc(FNAME) = Y
Next i
End If
.NewSearch
.LookIn = ThisWorkbook.Path
.SearchSubFolders = True
.Filename = "*.bmp"
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Y = .FoundFiles(i)
d = InStrRev(Y, "\")
FNAME = Mid(Y, d + 1, 999)
If Not dicPictuce.Exists(FNAME) Then dicPictuce(FNAME) = Y
Next i
End If
End With
End Sub
这个只在03以其低版本有效,07开始,已经不用了。
要查找文件可以直接用DIR
|
|