Scripting.Dictionary (1 Viewer)

bauer

Registered User
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!
 

bauer

Registered User
Joined
Aug 23, 2001
Messages
77
Thank you, I should've seen that one.
 

bauer

Registered User
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 (Users: 0, Guests: 1)

Top Bottom