Date: prev next · Thread: first prev next last
2025 Archives by date, by thread · List index


I asked:

Near as I can tell, the way to do this is with a macro. I've tried
following several guides but it isn't working. What I want is really
simple: Select a shortcut (say F3) and have my spreadsheet respond as
though I had pressed four keys, F2 to start editing a cell, HOME to
position my cursor at the start of the cell, DEL to delete the first
character in the cell, ENTER to finish editing. But when I tried to
record this macro, nothing happened until I selected a cell. Then when
I tried to run the macro, the current cell was changed to contain what
the cell contained where recording was performed. What am I doing wrong?

Andrew Pitonyak answered:

First, let me tell you what your macro does.
 
You clicked in a specific cell, which made that cell the current cell. In this
case you clicked in Cell E4, so these lines in your macro set the cell E4 to 
be current.
 
args1(0).Name = "ToPoint"
args1(0).Value = "$E$4"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
 
Next, you enter \u201cInput Mode\u201d
dispatcher.executeDispatch(document, ".uno:SetInputMode", "", 0, Array())
 
And finally, you enter the string 132, which is NOT simply removing the first 
character.
args3(0).Name = "StringName"
args3(0).Value = "132"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args3())
 
What you want to do is to check to see where the cursor is located or to check
what cells are selected rather than selecting a specific cell.

What I want to do is exactly what I wrote initially. Without changing
the selected cell, just act like I had pressed those four keys in order.
If I do that manually, the cell content doesn't change except for the
removal of the first character. It shouldn't be hard to do that with a
macro or other repeatable process. I'm not worried about checking the
existing content of the cell; I won't run the macro unless the current
cell is an appropriate one. I'm not asking to run the macro on more than
one cell at a time, just the current cell.

You seem to be telling me that I can't do this in a simple way, even
though my desire is extremely simple. It shouldn't be necessary to write
a program to do it. For example, with VI, it's just ":map z xxxx" where
xxxx is some sequence of VI commands. Surely LO can do the equivalent.
-- 
         Dave Close, Compata, Irvine CA       +1 714 434 7359
       dave@compata.com              dhclose@alumni.caltech.edu
       "Computers are useless. They can only give you answers."
                                   -- Pablo Picasso



-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.