Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help on Dictionary datatype??

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help on Dictionary datatype??

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")


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

wrote in message
ups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help on Dictionary datatype??

This appears to work perfectly!

many thanks.

A

Chip Pearson wrote:
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")


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

wrote in message
ups.com...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limitation of collection and dictionary datatype iamrajy[_7_] Excel Programming 1 January 27th 06 04:58 PM
determining datatype davegb Excel Programming 8 December 1st 05 09:29 PM
DataType Property Access101 Excel Programming 3 August 25th 05 08:15 PM
need help- SUB: DATATYPE FOR A CELL.. monika Excel Programming 1 February 13th 04 02:13 PM
DataType Conversion AsimKhaliq Excel Programming 0 January 21st 04 12:40 AM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"