如何在 Access 2007 的宏中自动保存导入?

发布于 2024-12-02 02:11:44 字数 559 浏览 0 评论 0原文

我创建了一个宏来运行保存的导入(从 Excel 导入 Access 2007 的文件)。当我运行宏时,保存的导入将运行并发生以下情况:

  1. 弹出“管理数据任务”窗口。
  2. 我必须从以下选项中进行选择:运行创建 Outlook 任务...删除 和 <代码>关闭。
  3. 如果我选择运行,下一个弹出窗口会询问“覆盖现有表或查询?”
  4. 我必须选择:
  5. 弹出另一个窗口并显示“所有对象均已成功导入”。
  6. 我必须单击确定按钮。
  7. 我必须单击“管理数据任务”窗口上的关闭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:

  1. A "Manage Data Tasks" window pops up.
  2. I have to choose from the following options: Run, Create Outlook Task..., Delete, and Close.
  3. If I select Run, the next pop-up asks, "Overwrite existing table or query?"
  4. I have to choose: Yes or No.
  5. Another window pops up and says, "All objects were imported successfully."
  6. I have to click the OK button.
  7. I have to click the Close 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁吢 2024-12-09 02:11:44

如果您使用 DoCmd.RunSavedImportExport 方法,则无需与 Manage 进行交互数据任务对话框根本没有。

   DoCmd.RunSavedImportExport "YourSavedImportName"

但是,您必须处理可能出现的错误。例如,如果您的源文件不可用,您将收到类似的错误

运行时错误“3011”:

Microsoft Office Access 数据库引擎找不到该对象
“表 1”。确保该对象存在并且您拼写了它的名称和
路径正确。

If you use the DoCmd.RunSavedImportExport Method you won't have to interact with the Manage Data Tasks dialog at all.

   DoCmd.RunSavedImportExport "YourSavedImportName"

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

Run-time error '3011':

The Microsoft Office Access database engine could not find the object
'Sheet1'. Make sure the object exists and the you spell its name and
the path correctly.

春风十里 2024-12-09 02:11:44

这可能太简单了,但是您可以在导入之前在宏中使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文