Call a Subroutine from a different Module in VBA

无人久伴 提交于 2019-11-27 01:12:42

问题


Is it possible to call a function from one Module to another?

I have the following code:

Sub MAIN()
    Call IDLE
End Sub
  • MAIN is located in Module1
  • IDLE is located in Module2 and defined as: Sub IDLE()

回答1:


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.



来源:https://stackoverflow.com/questions/2804327/call-a-subroutine-from-a-different-module-in-vba

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!