gpt4 book ai didi

vba - 在VBA中定义函数别名,可能吗?

转载 作者:行者123 更新时间:2023-12-04 13:35:06 24 4
gpt4 key购买 nike

我在MS Access后面使用VBA
假设我有全局方法foo1和foo2,它们获得相同的参数,但执行不同的操作。
我知道在C++中可以为函数分配别名。就像是:
代替:

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

我要写:
Var new_func = Iff (term, foo1,foo2)
new_func arg1, arg2, arg3

我可以在vba上执行此操作吗?

最佳答案

会适合吗?

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

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

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

关于vba - 在VBA中定义函数别名,可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4312447/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com