[libreoffice-users] Question on getting a list of all the macro commands

2020-11-30 Thread Michael D. Setzer II
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+unsubscr...@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



Re: [libreoffice-users] Question on getting a list of all the macro commands

2020-11-29 Thread Jean-Francois Nifenecker

Hello Mike,

Le 29/11/2020 à 18:33, Michael D. Setzer II a écrit :

Does a file with them exist in full or part.


nope. Well, not that I know of. The LibO API (application programming 
interface) is a quite complex beast.



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.


The LibreOffice macro recorder is a *very* limited tool, which has 
nothing to see with some other Office suite recorder. The LibO recorder 
just records your actions in the GUI (keyboard and mouse actions) and 
translates them using a special object, the Dispatcher.


The resulting code has very little to see with actual macro code you 
might write to accomplish the very same actions in "purer" Basic.


This doesn't mean the recorder is useless. I use it everytime I need a 
quickly automated process. But don't rely on it to manage (not so) 
complex processes.


If you want to delve in Basic macro coding, as an English-speaking user 
you should read Andrew Pitonyak's books. Check Andrew's website here: 
https://www.pitonyak.org/oo.php.
His macro document is a collection of predefined macros, while his book 
is more elaborated. Both are highly recommended reads!


For a quick start, you might also find the 9 reference sheets available 
from the LibO extension pages handy:

https://extensions.libreoffice.org/?Tags%5B%5D=173


HTH,
--
Jean-Francois Nifenecker, Bordeaux


--
To unsubscribe e-mail to: users+unsubscr...@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


[libreoffice-users] Question on getting a list of all the macro commands

2020-11-29 Thread Michael D. Setzer II
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 documentas 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+unsubscr...@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