Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not accept object keys #7

Closed
JNurick opened this issue Apr 20, 2015 · 1 comment
Closed

Does not accept object keys #7

JNurick opened this issue Apr 20, 2015 · 1 comment

Comments

@JNurick
Copy link

JNurick commented Apr 20, 2015

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
Copy link
Author

JNurick commented Apr 20, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants