Closed JNurick closed 9 years ago
I should have deleted the declarations of V and Ar; I'd used them to check behaviour with array keys. Neither Scripting.Dictionary nor VBA-Dictionary accept them, but they may not return the same error number when one tries.
Sub T2() Dim SD As Object Dim VD As Dictionary Dim C As Collection Dim V As Variant Dim Ar(1) As Long Const MSG = "This item's key is a collection"
Set SD = CreateObject("Scripting.Dictionary") Set VD = New Dictionary
Set C = New Collection C.Add "First" C.Add "Second"
SD.Add "Ocelot", "Cat" SD.Add C, MSG Debug.Assert SD(C) = MSG
VD.Add "Ocelot", "Cat" VD.Add C, MSG 'Error 457 End Sub