MS Access VBA 一起运行所有保存的导入 [英] MS Access VBA to run all saved imports together
问题描述
我正在寻找一个 VBA 代码来在 MS Access 2010 中运行多个保存的导入.我使用了 DoCmd.RunSavedImportExport "*"
但给出了一个错误.
I am looking for a VBA code to run multiple saved imports in MS Access 2010. I used DoCmd.RunSavedImportExport "*"
but gave an error.
我知道我在这里做错了.请理解我是 VBA 的新手.我在特定位置以 .csv 格式保存了近 8 个导入.我想要的只是通过 VBA 使其自动化.
I know I am doing something wrong here. Please understand I am a newbie to VBA. I have almost 8 saved imports in .csv formats in a specific location. All I want is to automate it through VBA.
推荐答案
我想您已经采取了所有其他必要的步骤.循环遍历保存的导入/导出并一一执行.类似:
i guess you have taken all other necessary steps already. loop through the saved import/export and execute them one by one. something like:
伪将是:循环导入/导出并手动执行.
pseudo would be: loop through the import/export and execute it manually.
在代码中将是:
Dim i As Integer
For i = 0 To CurrentProject.ImportExportSpecifications.count - 1
Debug.Print CurrentProject.ImportExportSpecifications(i).name
DoCmd.RunSavedImportExport CurrentProject.ImportExportSpecifications(i).name
Next i
编辑
您的 ImportExportSpecifications 详细信息以 XML 格式保存,您可以通过
Your ImportExportSpecifications details are saved as XML format and you can access that information via
CurrentProject.ImportExportSpecifications(i).XML
在 XML 中,您将找到 path = "your file.xlsx".执行字符串作业以提取路径并验证文件结尾并实现您的代码.
within the XML you will find the path = "your file.xlsx". Do a string job to extract the path and validate the file ending and implement your code.
这篇关于MS Access VBA 一起运行所有保存的导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!