RANDBETWEEN retains its value in OO, why not in LibreOffice? at
viewtopic.php?f=9&t=106786
I thought I found a great solution to this, but…
I discovered this:
In Sheet>Fill Cells>Fill Random Number it will generate random numbers that don’t change whenever you do anything else with the spreadsheet. It just puts random numbers in selected cells without any formula.
Libre Office has this feature. Open Office doesn't. So Libre Office is better. Now we're talking. I thought.
So I tried to record a macro that, at the click of a button (which I need to have on the spreadsheet to generate the random number), would put a random number into cell A1 (which was already selected), and this is what it looked like:
Code: Select all
sub random1
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 dispatcher.executeDispatch(document, ".uno:RandomNumberGeneratorDialog", "", 0, Array())
end sub
I still have the solution I came up with in the old thread, but this one seems cleaner and easier if I could get it to work.
Anyone know why this doesnt work and/or how I could make something like this work?