在VBA中定义功能别名,可能吗? [英] define a function alias in VBA, possible?

查看:150
本文介绍了在VBA中定义功能别名,可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MS Access
后面使用VBA说我有全局方法foo1和foo2,它们具有相同的参数但执行不同的操作。
我知道在C ++中可以为函数分配别名。类似于:
而不是:

I am using VBA behind MS Access Say I have global methods foo1 and foo2 that gets the same arguments but do different things. I know that in C++ I can assign a function an alias. Something like: instead of:

If (term) then
   foo1 arg1, arg2, arg3
else
   foo2 arg1, arg2, arg3
End If

I想写:

Var new_func = Iff (term, foo1,foo2)
new_func arg1, arg2, arg3

我可以在vba上这样做吗?

Can I do this on vba?

推荐答案

会穿西装吗?

new_func = IIf(term, "foo1", "foo2")
''new_func arg1, arg2, arg3

res = Run(new_func, "a", "b", 1)

更多信息: http://msdn.microsoft.com/zh-CN/library/aa199108(office.10).aspx

这篇关于在VBA中定义功能别名,可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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