从 VBA 中的不同模块调用子程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2804327/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 10:25:43 来源:igfitidea点击:
Call a Subroutine from a different Module in VBA
提问by Nimrod
Is it possible to call a function from one Moduleto another?
是否可以从一个函数调用另一个函数Module?
I have the following code:
我有以下代码:
Sub MAIN()
Call IDLE
End Sub
MAINis located inModule1IDLEis located inModule2and defined as:Sub IDLE()
MAIN位于Module1IDLE位于Module2并定义为:Sub IDLE()
回答by dcp
Prefix the call with Module2 (ex. Module2.IDLE). I'm assuming since you asked this that you have IDLE defined multiple times in the project, otherwise this shouldn't be necessary.
使用 Module2 为调用添加前缀(例如Module2.IDLE)。我假设既然你问了这个,你在项目中多次定义了 IDLE,否则这不是必要的。

