I believe that in order to change an item in the array, the entire array
needs to be changed at the same time.
If I understand the question correctly, here is one idea...
Sub Demo()
Dim Dic
Dim M 'Matrix Array
Set Dic = CreateObject("Scripting.Dictionary")
' Add Key, Item (Both Required)
Dic.Add "Hello", Array("Zero", "Item1")
Debug.Print Dic("Hello")(0)
Debug.Print Dic("Hello")(1)
'Get Data to change
M = Dic("Hello")
'New Data
M(1) = M(1) & ", Item2"
'Change it
Dic("Hello") = M
Debug.Print Dic("Hello")(0)
Debug.Print Dic("Hello")(1)
End Sub
= = = = =
HTH
Dana DeLouis
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
|