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

Selection order not preserved - MACRO - or need ordered list of selected value

Hi,

I'm having problem with selection order, i want "Ordered" selection, like if i select 2006-Q1,2005-Q1, 2004-Q1 it should select that in that order when write following:

Selected_Date = ActiveDocument.fields("Quarter").GetSelectedValues

Instead it gives me random selection.

for i = 0 to Selected_Date.Count - 1
StartQuarter = StartQuarter & " - " & Selected_Date.Item(i).Text
next

Then i store it in the Variable and display in the TextObject. i Want Output 2004-Q1,2005-Q1,2006-Q1

Can anyone help Please!

1 Solution

Accepted Solutions
Not applicable
Author

if you set the sort order in the document properties, then it should work like this:

.GetSelectedValues(0,true)



View solution in original post

4 Replies
Not applicable
Author

Try 2 things:

1. check the sort order of Quarter in Document Properties

2. Set the 2nd parameter of GetSelectedValues (UseDefaultOrder) to true.

Not applicable
Author

Option No1 doe snot work.

Option 2 :

I tried following

1. GetSelectedValue , true - this throws exception

2. GetSelectedValue(true) throws exception

Any idea?

Thanks,

Nish.

Not applicable
Author

if you set the sort order in the document properties, then it should work like this:

.GetSelectedValues(0,true)



Not applicable
Author

You ROCK.! it worked ! Thanks a Ton.