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


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?

I've looked at the macro code generated and don't see anything related
to what I want. I'd try to fix it but have no clue what to change. Here's
the macro which was recorded.

sub Neg
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$E$4"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SetInputMode", "", 0, Array())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "StringName"
args3(0).Value = "132"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args3())
end sub

Yeah, E4 was the cell where I tried recording and its value at that time
was 132. But I don't want to always do this only on that cell and I don't
want the result to always be 132.
-- 
         Dave Close, Compata, Irvine CA       +1 714 434 7359
       dave@compata.com              dhclose@alumni.caltech.edu
      "Punctuality is the virtue of the bored."  -- Evelyn Waugh



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