Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Listbox selection order

Hi,

I currently have a macro that displays the selected values of a field in a listbox.

set s = ActiveDocument.Fields("DrillField").GetSelectedValues

for i = 0 to s.Count-1
msgbox(s.Item(i).Text)
next

However, no matter the order I select the values in the list box, the array of selected values always comes back the same as the listbox's sort order.  Is there a way to retrieve the selected values of the field in the order that they were selected?

Thanks.

James

13 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

There is no need to eliminate duplicates manually.  You can use

=Concat(DISTINCT FieldName, ',')

Regards,

Jagan.

Not applicable
Author

Is there a way to remove a single value from the concatenated string?  Would you use something like a replace with an empty string?  That would certainly simplify the code.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Interesting. I like it. You may want to turn off "Allow Pivoting" in the Presentation properties. If I drag a dimension and them make a selection I lose my dragged change.

-Rob

Not applicable
Author

Good point.  I'll disable that.  Thanks.