如何在 Access 2007 的宏中自动保存导入?
我创建了一个宏来运行保存的导入(从 Excel 导入 Access 2007 的文件)。当我运行宏时,保存的导入将运行并发生以下情况:
- 弹出“管理数据任务”窗口。
- 我必须从以下选项中进行选择:
运行
、创建 Outlook 任务...
、删除
和 <代码>关闭。 - 如果我选择
运行
,下一个弹出窗口会询问“覆盖现有表或查询?” - 我必须选择:
是
或否
。 - 弹出另一个窗口并显示“所有对象均已成功导入”。
- 我必须单击
确定
按钮。 - 我必须单击“管理数据任务”窗口上的
关闭
e按钮。
如果所有这些按钮点击始终是相同的,有什么方法可以自动执行这些按钮点击吗? (粗体按钮是我经常点击的按钮。)
I have created a macro to run a saved import (a file imported from Excel into Access 2007). When I run the macro, the saved import runs and the following happens:
- A "Manage Data Tasks" window pops up.
- I have to choose from the following options:
Run
,Create Outlook Task...
,Delete
, andClose
. - If I select
Run
, the next pop-up asks, "Overwrite existing table or query?" - I have to choose:
Yes
orNo
. - Another window pops up and says, "All objects were imported successfully."
- I have to click the
OK
button. - I have to click the
Clos
e button on the "Manage Data Tasks" Window.
Is there any way that I can automate all these button clicks if they are always going to be the same? (The bold faced buttons are the ones that I'll always be clicking.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 DoCmd.RunSavedImportExport 方法,则无需与 Manage 进行交互数据任务对话框根本没有。
但是,您必须处理可能出现的错误。例如,如果您的源文件不可用,您将收到类似的错误
If you use the DoCmd.RunSavedImportExport Method you won't have to interact with the Manage Data Tasks dialog at all.
You will however have to deal with the possible errors that get raised. For example if your source file is unavailable you will get an error like
这可能太简单了,但是您可以在导入之前在宏中使用 Setwarnings:off 命令吗?
现在我想看到自动导入的宏
This may be too simple, but can you use the Setwarnings:off command in your macro before you import.
Now I would like to see the macro to automate the import