Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am trying to create list boxes dynamically as part of the 'OnPostReload'.
With v9 (I am using SR3) there is now the option to sort by state 'Auto Ascending' as well as ascending and descending. Defaulting to 'Auto Ascending' is a pain and I hate it!
By macro, whatever value I set SortByState to (only value allowed are -1, 0, 1) I can never set SortByState off and I actually want to set the state to Ascending. Is there a bug? See my code below and notice that SortByText is commented out as this doesnt seem available.
sub setlb18
set LB = ActiveDocument.GetSheetObject("LB18")
set BoxProp = LB.GetProperties
BoxProp.SortCriteria.SortByState = -1
BoxProp.SortCriteria.SortByExpression = 0
BoxProp.SortCriteria.SortByFrequency = 0
BoxProp.SortCriteria.SortByNumeric = 0
' BoxProp.SortCriteria.SortByText = 0
BoxProp.SortCriteria.SortByLoadOrder = 0
LB.SetProperties BoxProp
end sub
Also, I really want to set each of them the same but I only seem to be able to do so by setting them individually - is there a way of setting them 'same as'?
Any help appreciated.
Gordon
Aha!
I found 'SuppressAutoSortByState' which seems to do the job!
sub setlb18
set LB = ActiveDocument.GetSheetObject("LB18")
set BoxProp = LB.GetProperties
BoxProp.SuppressAutoSortByState=true
BoxProp.SortCriteria.SortByState = 1
BoxProp.SortCriteria.SortByExpression = 0
BoxProp.SortCriteria.SortByFrequency = 0
BoxProp.SortCriteria.SortByNumeric = 0
' BoxProp.SortCriteria.SortByText = 0
BoxProp.SortCriteria.SortByLoadOrder = 0
LB.SetProperties BoxProp
end sub
I would still love to set up a template for list box settings though.....
Regards,
Gordon