Can I open the "Find and Replace" menu item with Libre BASIC

The record feature doesn’t capture when I select the ctrl+H or the Menu item. I need my user to press a button that will paste the data into the sheet and programmatically open the “Find and Replace” dialog. I would also be great if I could populate the find and replace fields in that dialog with the program
Thank You…
David

hello @David_Burk,

‘kiss’ try …

if you don’t find a viable solution for exact your idea in ask or ‘the web’,

try to deal with what you have,

mark two cells on the sheet for search string and replacement (or more for other options you have a sample in the recorded ‘dispatcher options’), write a macro and set the options according to those cells and rund the replace, customize that macro to a button named ‘replace’, and you’re done …

ok?

P.S. ‘solved marks’ and ‘likes’ welcome,
click the grey circled hook - ✓ - top left to the answer to turn it green if the problem is solved,
click the “^” above it if you ‘like’ the answer,
“v” if you don’t,
do not! use ‘answer’ to add info to your question, either edit the question or add a comment,
‘answer’ only if you found a solution yourself …

Mike gave me the answer…

rem Open Find&Replace Menu-----------------------------------------------
createUnoService("com.sun.star.frame.DispatchHelper").executeDispatch(ThisComponent.CurrentController.Frame, ".uno:SearchDialog", "", 0, Array())

This dude knows it all :slight_smile:
mikekaganski

I don’t think there is a dispatcher comand for just opening the F&R dialog.
But why should the F&R dialog be opened?

You can do as @newbie-02 already suggested.
You can use a specialised dialog.
You can get information via the InputBox function.
If the needed input will repeat, you can store the information to the control object (Button).
You can use a control with some RadioButtons to be able to change the settings for subsequent calls.

Lots of nice things you can do regarding your needs.

A simple example using the information stored to the button object is attached.
ask273180FindAndReplace.ods

Thank you guys for your response I will use the ideas you have to further improve my code. The answer to my questions. is

createUnoService(“com.sun.star.frame.DispatchHelper”).executeDispatch(ThisComponent.CurrentController.Frame, “.uno:SearchDialog”, “”, 0, Array())

mikekaganski gave me that solution and it works perfectly Mikes a pretty impressive developer…

@David_Burk: Please do us a favor, and give a link to the post @Mike2 Kganski suggested that solution in.

@David_Burk: impressive! as well the questionable complexity as @mikekaganski having it at hand!

pls. provide your comment as an ‘answer’ to get this question closed