如何使用VBA以编程方式在其他(即外部)Access数据库中调用宏? [英] How to programatically call a macro in a different (ie. external) Access database using VBA?

查看:478
本文介绍了如何使用VBA以编程方式在其他(即外部)Access数据库中调用宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Access Database1来调用Access Database2中的宏.

I want to use Access Database1 to call a macro in Access Database2.

下面的链接描述了如何在visio程序中调用外部宏,但是语法与Access似乎有些不同.

The link below describes how to call an external macro in a visio program, but the syntax seems to be a little different with Access.

如何我可以调用另一个文件中定义的VBA宏吗?

基本上,我想做这样的事情(在数据库1中)

Basically, I want to do something like this (from within database 1)

AccessDatabase=pathToOtherDatabase.mdb

AccessDatabase.runMacroA

有人知道该怎么做吗?

推荐答案

您可以使用内置的Shell命令来调用辅助数据库,并在命令行开关中将其传递给宏名称,这将强制您的辅助数据库执行以下操作:在打开时执行所需的宏.有关访问命令行开关的更多信息,请参见:

You could use the built in Shell command to call your secondary database, and pass it the macro name in the command line switch, this would force your secondary database to execute the desired macro on open. More about Access command line switches can be found here:

http://support.microsoft.com/kb/209207

这篇关于如何使用VBA以编程方式在其他(即外部)Access数据库中调用宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆