LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default dictionary keys

Hi Julio,

What you have ought to work in theory, but I get the same error you do.
It seems like the Dictionary object doesn't like late binding. If I set a
reference to the Microsoft Scripting Runtime and change the code to use
early binding as shown below it works as expected.

Sub Macro1()

Dim dic As Scripting.Dictionary
Dim s As String

Set dic = CreateObject("Scripting.Dictionary")

dic.Add "foo", "bar"

s = dic.Keys(0)

End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"julio" wrote in message
...
How do you access dictionary keys? What's wrong with this? (I get runtime

error "let not defined, get doesn't return object" or the other way around)

Sub Macro1()

Dim dic As Object
Dim s As String

Set dic = CreateObject("Scripting.Dictionary")

dic.Add "foo", "bar"

s = dic.keys(0)

End Sub



 
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
Customizing a dictionary Grant Excel Worksheet Functions 3 September 10th 09 01:22 PM
How to remove a word from dictionary? robmirabile Excel Discussion (Misc queries) 7 December 8th 04 06:39 PM
dictionary function wandering mage Excel Programming 6 June 15th 04 04:42 PM
Dictionary Functions Wandering Mage Excel Programming 0 June 11th 04 04:01 AM
Dictionary objet Zwi Excel Programming 2 January 26th 04 01:57 PM


All times are GMT +1. The time now is 05:22 PM.

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"