更新时间:2022-10-26 22:38:11
你好Anthony,
听起来你可能需要一个递归函数。此外,如果您要遍历子文件夹,***使用文件系统对象而不是Dir()命令。
只是想一想......
Hi,
I have the following code that imports Excel sheets in one Access Table
Code works fine however there are a series of sub-folders that sit beneath the folder testing.
Any help is much appreciated
Anthony
Public Function Import_Multi_Excel_Files() Dim InputFile As String Dim InputPath As String InputPath = "\\server\dfsroot$\Change\3\Impacts\testing" InputFile = Dir(InputPath & "*.xlsx") Do While InputFile <> "" DoCmd.TransferSpreadsheet acImport, , "tests" & Format(Now(), "ddmmyy"), InputPath & InputFile, True, "Action Plan!" InputFile = Dir Loop End Function
Hi Anthony,
Sounds like you might need a recursive function. Also, if you're going to loop through subfolders, you might be better off using a File System Object rather than the Dir() command.
Just a thought...