这对我来说不起作用,而且原因也不清楚。
如何从函数中返回一个字典?
Sub mySub()
dim myDict as Dictionary
myDict=new Dictionary
myDict=myFunc()
End Sub
Function myFunc()
dim myDict2
set myDict2 = new Dictionary
'some code that does things and adds to myDict2'
myFunc=myDict2
End Function
如何从函数中返回一个字典?
myFunction = Value
(或SET myFunction = Object
)是 VBA 中等同于RETURN Value
的语句。 - BradCmyFunc(1)=
,你只想要myFunc=
,否则你只是把字典的第一个值设置为整个其他对象,这不是你想要的。 - BradC