Can I disable the "Extend Selection" question the comes up when I sort a column?

I have a macro that, among other things, sorts a single column that has adjacent columns. When my user invokes the macro they get the “Extend Selection” question. Can I suppress this?

Change the macro code as explained at Sort Warning to Expand Selection (View topic) • Apache OpenOffice Community Forum.

Sub SortSelection
   Dim Doc As Object
   Dim SortData As Object
   Dim oSortDesc(1) As New com.sun.star.beans.PropertyValue
   Dim oSortField(0) As New com.sun.star.table.TableSortField
   
   Doc = ThisComponent
   SortData = Doc.CurrentSelection
               
   oSortField(0).Field = 0
   oSortField(0).IsAscending = True
   oSortField(0).FieldType = com.sun.star.table.TableSortFieldType.AUTOMATIC
   oSortDesc(0).Name = "SortFields"
   oSortDesc(0).Value = oSortField
   oSortDesc(1).Name = "ContainsHeader"
   oSortDesc(1).Value = False

   SortData.sort(oSortDesc)
End Sub

Perfect, works, thanks

Glad it works. Please click ‎✔ to mark this answer as correct.