Scripting.Dictionary (1 Viewer)

bauer

Registered User.
Local time
Today, 07:10
Joined
Aug 23, 2001
Messages
77
Hi there,

I'm having a bit of trouble. I am trying to use the dictionary object, however, when I run my code, I get an error of the object required on the red line below.

Here is my code, though nothing amazing
Code:
Dim dCat As Object
[COLOR=red]Set dCat = CreateObject(Scripting.Dictionary)[/COLOR]

I've lloked around a bit, but couldn't seem to find anything. VBA help only has a few topics on the object itself. Although, it could be something with the fact that it's an ActiveX object (which I don't know too much about).

Any and all help would be appreciated.

Thank you!
 

Jon K

Registered User.
Local time
Today, 11:10
Joined
May 22, 2002
Messages
2,209
Set dCat = CreateObject("Scripting.Dictionary")
 

bauer

Registered User.
Local time
Today, 07:10
Joined
Aug 23, 2001
Messages
77
Thank you, I should've seen that one.
 

chewy

SuperNintendo Chalmers
Local time
Today, 11:10
Joined
Mar 8, 2002
Messages
581
whats a scripting dict?
 

bauer

Registered User.
Local time
Today, 07:10
Joined
Aug 23, 2001
Messages
77
It's an object that takes a key/value pair I think it's like a hash
ex:
Code:
Dim dict
Set dic = CreatObject("Scripting.Dictionary")
dic.addItem "banana", "yellow"
dic.addItem "orange", "orange"
dic.addItem "apple", "red"
dic.addItem "grape", "green"
Then you could refernce the dictionary object with the fruit name and get the color.

Or you can look up in VBA help
 

Users who are viewing this thread

Top Bottom