一定要用可引用ACCESS,过渡一下. 参考这儿6楼DannyK2316的发言:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=450752&SiteID=1 Sub processFiles() Dim app02 As New Access.Application Dim filename Dim NumFiles NumFiles = 0 line1: With Access.Application.FileSearch .NewSearch .LookIn = "C:\Temp\Dataprep\" .SearchSubFolders = False .MatchTextExactly = True .filename = "*.*" .Execute End With If FileSearch.FoundFiles.Count > 0 Then filename = FileSearch.FoundFiles.Item(1)
'Put your code that processes files here Name filename As Left(filename, 17) & "processed\" & Mid(filename, 18, 60) NumFiles = NumFiles + 1 GoTo line1 Else End If MsgBox NumFiles & " File(s) Processed!", vbOKOnly, "Finished!" End Sub
|