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


Does a file with them exist in full or part.
Was recently looking thru menus and found something interesting that I 
had not noticed before.
Data / Calculate / Formula to Value

I did a test, and it did what I wanted, so recorded the macro.
Strangely, the command to do the Formula to Value was there, but it had 
rem in front of it, so macro would not work as recorded. Removed the 
rem, and it worked fine?? So, this can duplicate the F9 Enter option for 
some things. 

sub xx12
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 ----------------------------------------------------------------------
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "StringName"
args1(0).Value = "=sum(k2:k57)"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:ConvertFormulaToValue", "", 0, Array())
end sub

My main macro in this sheet takes a set of data from a web site. that is placed in a2:o64.
Only need data in a2:d64 and the total of data in K2;K57. So, macro delete columns E to O.
But need to save total of K2:K57. Had been entering formula manually, and using F9 to convert it.
Just need to put this code in main macro to automate how process to the macro I have linked to 
Shift-F4. Updates covid data from 50 states, D.C., and 5 Territories.. So, run it as data changes.
Perhaps there are lots of other such processes outthere. 
Still find it strange that the recorder recorded it, but did it as a remark??

Thanks again..

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