我有以下代码:
Function MC() As Object()
Dim RulesList(0 To 10) As Object
Dim Rule
Set Rule = CreateObject("Scripting.Dictionary")
Rule.Add "Sender", "Test"
Rule.Add "Subject", "bbb"
Rule.Add "Folder", "ccc"
Rule.Add "MarkRead", False
Set RulesList(0) = Rule
Set Rule = CreateObject("Scripting.Dictionary")
Rule.Add "Sender", "Java"
Rule.Add "Subject", "bbb"
Rule.Add "Folder", "ccc"
Rule.Add "MarkRead", False
Set RulesList(1) = Rule
Set MC = RulesList
End Function
在 Outlook VBA 中。代码抛出
“编译错误:无法在 Set MC = RulesList 线上分配给数组
有人可以帮我吗?我想创建一个字典对象数组并返回它们。
EDIT: Removing () at the end of function signature and using MC = RulesList in place of Set MC = RulesList works, however, I can't assign this in my calling function anymore, can anyone point me to help on that?