I have a workbook in which I have used Calc’s menu to define a DatabaseRange
using Data > Define Range. The workbook has a macro that builds a SortDescriptor
which includes several values and invokes the sort using:
Range.Sort(SortDescriptor())
. The Sort works just fine.
Further along, the macro retrieves the Database’s FilterDescriptor
using DatabaseRange.getFilterDescriptor
. It goes on to modify that FilterDescriptor
and imposes that modified descriptor on the same range using DatabaseRange.refresh()
. That filtering operation, too, works just fine. Except …
The SortDescriptor
that is a Property of the DatabaseRange
is not the same as the SortDescriptor
which the macro built and applied earlier. And when the Refresh
is executed, the SortDescriptor
that is a Property of the DatabaseRange
overrides the one that was built and executed earlier and re-does the sort based on whatever manual sort selections were last manually applied using the AutoFilter pull-downs.
This page indicates that the refresh
method “executes the stored import, filter, sorting, and subtotals descriptors again.” But the SortDescriptor
Property of the DatabaseRange
is Read-Only.
How does one go about modifying or replacing the SortDescriptor
that is a Property of the DatabaseRange
?