简单地说你必须有一个函数返回一个变体。我可以看到你喜欢以面向对象的方式来做,但如果你只是想“完成它”,程序上是最简单的。
虽然有几种方法可以做到这一点,但这是我首选的方法。请注意,您可以创建任何基本数据类型的列表(即字符串,变体,整数,长整数等)。
Function myfunc as variant
dim mylist list as variant
mylist("somename") = "the value you want to store"
mylist("someothername") = "another value"
myfunc = mylist
End Function
要使用MYFUNC ..
sub initialise
dim anotherlist list as variant
anotherlist = myfunc
end sub
您可以添加参数,如果你只需要定义MYFUNC这样
function myfunc(val1 as variant, val2 as variant) as variant
你把它与参数相同的方式需要到MYFUNC像这样
anotherlist = myfunc("a value", "another value")
请注意,“变体”是您的通用数据类型。重要的是,myfunc作为变体是您可以从函数返回列表和变体的唯一方式。
这是Lotus Notes/Domino如何用一千个剪纸杀死你的一个例子.... – iconoclast 2013-04-30 13:28:06