VBA-tools / VBA-Dictionary

Drop-in replacement for Scripting.Dictionary on Mac
MIT License
358 stars 89 forks source link

Does not accept object keys #7

Closed JNurick closed 9 years ago

JNurick commented 9 years ago

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

JNurick commented 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.