vba - How to remove duplicate items in listbox -


i created code add found items enclosed "[]" or "()" or "{}". if in word document have "ouch! [crying] hurts! [crying] [laughing]" items enclosed "[]" added listbox , there 3 of 2 same. want merge them.
how that?

sub cutsound()     dim arrs, arrs2, c2 variant, pcnt, x2, x3, intitems integer      pcnt = activedocument.paragraphs.count     arrs = array("[", "(", "{")     arrs2 = array("]", ")", "}")     userform1.show false     application.screenupdating = false     selection         .wholestory         c2 = 0 ubound(arrs)             .find.execute (arrs(c2))             while .find.found                 .moveenduntil cset:=arrs2(c2), count:=wdforward                 .moveright unit:=wdcharacter, count:=1, extend:=wdextend                 userform1.listbox1.additem selection.text                 .moveright unit:=wdcharacter, count:=1                 .endkey unit:=wdstory, extend:=wdextend                 .find.execute             loop         next c2     end     application.screenupdating = true end sub 

try merge in set rather list, maintains duplication.


Comments