I have this macro function for deleting strings that works:
Function findDeleteRegex( regex as string ) As Long
REM Returns: the number of found/replaced occurrences.
Dim oReplace as Object
oReplace = ThisComponent.createReplaceDescriptor()
oReplace.SearchRegularExpression = True
oReplace.setSearchString( regex )
oReplace.setReplaceString( "" )
findDeleteRegex = ThisComponent.replaceAll( oReplace )
End Function
Now I need to limit it to only selected text in the document just as can be done be checking a box in the dialog box that opens when in the document “Edit => Find and Replace …” is navigated to. In this documentation:
I do not see a way to do it. Can this be done?