多参数子 vba [英] multiple argument subs vba
本文介绍了多参数子 vba的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Access 2010 中使用 VBA,我有一个子项:
Using VBA with Access 2010, I have a sub:
Public Sub setInterest(account As String, dmonth As Integer)
...somecode...
End Sub
我用
setInterest("myAccount",3)
我收到语法错误.
将 sub 修改为只接受一个参数并省略 3 不会出错,只有当我有 2 个参数时才会出现问题.
And I get syntax errors.
Modifying the sub to only take one argument and leaving out the 3 gives no errors, the problem is only when I have 2 arguments.
推荐答案
当使用多个参数时,你可以这样写:
When using multiple arguments, you can either write:
setInterest "myAccount", 3
或者
Call setInterest("myAccount", 3)
在两个示例中,您都可以命名参数:
In both examples you can name the arguments:
setInterest account:="myAccount", dmonth:= 3
这篇关于多参数子 vba的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文