Ask Your Question
1

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

asked 2020-10-25 05:11:03 +0200

David_Burk gravatar image

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

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
1

answered 2020-10-31 21:10:50 +0200

David_Burk gravatar image

updated 2020-12-26 15:43:10 +0200

igorlius gravatar image

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 :) mikekaganski

edit flag offensive delete link more
0

answered 2020-10-29 22:45:08 +0200

Lupp gravatar image

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.
C:\fakepath\ask273180FindAndReplace.ods

edit flag offensive delete link more

Comments

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 gravatar imageDavid_Burk ( 2020-10-29 23:32:39 +0200 )edit

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

Lupp gravatar imageLupp ( 2020-10-30 15:22:36 +0200 )edit

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

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

newbie-02 gravatar imagenewbie-02 ( 2020-10-31 14:49:17 +0200 )edit
1

answered 2020-10-29 21:54:07 +0200

newbie-02 gravatar image

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 ...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-10-25 05:11:03 +0200

Seen: 163 times

Last updated: Dec 26 '20