Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Help on Dictionary datatype??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alan_deloitte@hotmail.co.uk - 18 Jan 2007 14:44 GMT
Hi,

fairly straight forward one here.

Can I create a nested Dictionary structure, that is, store and retrieve
Objects of type Dictionary within another Object of type Dictionary??

Also, I would be greatfull if someone could tell me where on MSDN i can
find this sort of information. All I am able to find is overly simple
examples using primitive data types, what I am looking for is a full
API documentation similar to that which Sun provide for the Java
programming language.

Many thanks in advance!

Alan
Chip Pearson - 18 Jan 2007 23:20 GMT
The following may get you started.

Dim MDict As Dictionary
Dim SubDict1 As Dictionary
Dim SubDict2 As Dictionary

Set MDict = New Scripting.Dictionary
Set SubDict1 = New Scripting.Dictionary
Set SubDict2 = New Scripting.Dictionary

SubDict1.Add Key:="A", Item:=1
SubDict1.Add Key:="B", Item:=2
SubDict2.Add Key:="X", Item:=88
SubDict2.Add Key:="Y", Item:=99
MDict.Add Key:="SubDict1", Item:=SubDict1
MDict.Add Key:="SubDict2", Item:=SubDict2

MDict.Item("SubDict1").Add Key:="Nest1", Item:=3
MDict.Item("SubDict1").Add Key:="Nest2", Item:=4

Debug.Print MDict.Item("SubDict2").Item("X")

Signature

Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

> Hi,
>
[quoted text clipped - 12 lines]
>
> Alan
alan_deloitte@hotmail.co.uk - 19 Jan 2007 16:38 GMT
This appears to work perfectly!

many thanks.

A

> The following may get you started.
>
[quoted text clipped - 42 lines]
> >
> > Alan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.