即使定义了sub,我也会收到编译器错误 [英] I'm getting a compiler error even though the sub is defined

查看:101
本文介绍了即使定义了sub,我也会收到编译器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个在我的一个表单模块中声明为public的子例程。在另一个表单模块中,我试图称之为。但是,当我尝试编译我的代码时,我收到一个错误,表示Sub或Function未定义。


我这样称呼它为:

I have created a subroutine that is declared as public in one of my form modules. In another form module I am trying to call it. However, when I try to compile my code, I get an error that says Sub or Function not defined.

I''m calling it like this:

展开 | 选择 | Wrap | >行号

推荐答案

表单模块虽然对所有代码都可见,但不是通用模块,因此在引用时需要限定。代码应为:
Form Modules, while visible to all code, are not General Modules, so need qualification when referred to. The code should read :
展开 | 选择 | Wrap | 行号


这样做了。即使在正常使用期间,被叫表格也会打开,我继续使用你的第一个选项,这样如果我需要对调用表单进行一些故障排除,我不必担心确保另一个表单是开放的。


感谢NeoPa!
That did it. Even though during normal use the called form will be open, I went ahead and used your first option so that if I ever need to do some troubleshooting on the calling form, I don''t have to worry about making sure another form is open.

Thanks NeoPa!


只是一些无用的信息。 Form'的类模块中定义的Sub-Routine本质上是该Form的方法,ergo
Just some useless information. A Sub-Routine defined within a Form''s Class Module is essentially a Method of that Form, ergo the
展开 | 选择 | Wrap < span class =codeDivider> | 行号


这篇关于即使定义了sub,我也会收到编译器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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