VBA - Set dictionary with convert to string e.g. EVAL -
hello friendly , nice people. idea following - have 1 dictionary of dictionaries , set loop , not each 1 separately. idea how it?
so far have this:
public sub mains() dim my_dict object dim d1 object dim d2 object dim d3 object dim d4 object dim d5 object dim d6 object dim d7 object dim d8 object dim long set my_dict = createobject("scripting.dictionary") = 1 8 set cstr(d & i) = createobject("scripting.dictionary") next end sub
is doable in vba? set cstr("d"& i) gives error of course, want similar , not set dictionaries 1 one.
you can't construct variable names programmatically. use array instead.
dim dicts(8) variant = 0 7 set dicts(i) = new dictionary next
alternatively, since goal build dictionary of dictionaries, can directly:
dim dict new dictionary, tmp dictionary = 0 7 set tmp = new dictionary dict.add "d" & + 1, tmp next
Comments
Post a Comment