0

我在 excel VBA 中制作了一个可重新分配的热键,因此想调用任意函数,包括那些采用任意参数的函数。

f1 = array("func1", 2) 'f1 takes 1 long arg
f2 = array("func2", UserClassArg) 'f2 takes one userclass arg

CallByName myclass, f1(0), vbMethod, f1(1) 'garbles second argument into some random number
CallByName myclass, f2(0), vbMethod, f2(1) 'type mismatch
CallByName myclass, f1(0), vbMethod, (f1(1)) 'works
CallByName myclass, f2(0), vbMethod, (f2(1)) 'object doesn't support this property or method
CallByName myclass, f2(0), vbMethod, UserClassArg 'works

如何存储可以稍后通过按名称调用调用的通用函数签名?

4

0 回答 0