View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jarek Kujawa[_2_] Jarek Kujawa[_2_] is offline
external usenet poster
 
Posts: 896
Default Array within a dictionary

this code:

Sub Test()
Dim hello()


hello = Array("Zero", "Item1")
Debug.Print hello(0)
Debug.Print hello(1)


hello(1) = hello(1) & ",Item2"
Debug.Print hello(1)


End Sub

will bring:
Zero
Item1
Item1,Item2

as the results


On 20 Lis, 13:54, jrpfinch wrote:
Please could somebody help me why this code does not work as expected
in Excel 2003:

Sub Test()
Dim dic As Dictionary
Set dic = New Dictionary

dic("Hello") = Array("Zero", "Item1")
Debug.Print dic("Hello")(0)
Debug.Print dic("Hello")(1)

dic("Hello")(1) = dic("Hello")(1) & ",Item2"
Debug.Print dic("Hello")(1)

End Sub

Output:
Zero
Item1
Item1

Thanks

Jon