Keyboard shortcuts for “Find Next” and “Find Previous” in LibreOffice

Solution 1:

Use .uno:ExecuteSearch (assuming that is what the recorder gave you), but instead of a hard-coded search string, input the value like this:

Global SearchString
Sub doSearch
    SearchString = InputBox("Search string:", "Search", "")
    ' Put the .uno:ExecuteSearch code here.
End Sub

Then change the hard-coded search string to use this variable:

args1(11).Name = "SearchItem.SearchString"
args1(11).Value = SearchString

Now for repeat searches, create two additional macros, one for each direction. Set "SearchItem.Backward" to true or false. Instead of another InputBox, use the SearchString variable that we stored earlier.