Scripting.Dictionary keys to Listbox VBA Excel -
i have been working vba in excel , began working scripting.dictionary object. hadn't run across major problems until today.
basically trying populate listbox key values of dictionary, add 1 more value listbox. results in value not being added listbox, dictionary key. have attempted copy values dict.keys() array separate array, still have same issue. assume byref problem have yet figure out solution. if has ideas awesome.
private sub setup_settinglst() 'set settings listbox items 'on error goto errorexit dim list_ary() variant dim tmp variant dim integer settinglst.clear settinglst.value = "-select setting-" = 0 tmp = tmp_dict.keys() if tmp_dict.count > 1 redim list_ary(0 tmp_dict.count) = 0 ubound(tmp) list_ary(i) = tmp(i) next list_ary(tmp_dict.count) = "back" else redim list_ary(0 tmp_dict.count - 1) = 0 ubound(tmp) list_ary(i) = tmp(i) next end if settinglst.list = list_ary erase list_ary exit sub errorexit: end sub
this seems work
private sub userform_click() dim dcvalues scripting.dictionary me.listbox1.clear set dcvalues = filldictionary me.listbox1.list = dcvalues.keys me.listbox1.additem "back" end sub
Comments
Post a Comment