从VBA中的其他模块调用子例程 [英] Call a Subroutine from a different Module in VBA

查看:1508
本文介绍了从VBA中的其他模块调用子例程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从一个Module调用另一个函数?

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

我有以下代码:

Sub MAIN()
    Call IDLE
End Sub

  • MAIN位于Module1
  • IDLE位于Module2中,定义为:Sub IDLE()
    • MAIN is located in Module1
    • IDLE is located in Module2 and defined as: Sub IDLE()
    • 推荐答案

      使用Module2(例如Module2.IDLE)对呼叫进行前缀.我假设自从您问这个问题以来,您已经在项目中多次定义了IDLE,否则就没有必要了.

      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.

      这篇关于从VBA中的其他模块调用子例程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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