On 06/11/2014 07:53 AM, Gavin Buxton wrote:
Hi

I'm writing a book on using spreadsheets for computer modeling, and on my
last model I've ran into a slight problem. Libreoffice calc is doing
something new. I'm using macro's to update the time step by simply copying
the new information over the old information. For example, imagine having a
number in cell A1 and then in cell B1 you type "=A1 + 1". Then you copy and
paste (special with number only) the number from B1 to A1, such that A1 is
now 1 more than it was to start with and B1 is now double the original A1.
I can keep running the macro and continually count upwards. I create a
button that when pressed runs the macro. However, whereas before pressing
the button repeatedly always worked, now I have to press the button and
then click elsewhere on the spreadsheet and then press the button again.

Wondering if I'm missing anything obvious?
Nope, probably not missing something obvious :-)

Are you using dispatch messages?

What happens if you change the macro to do something like this:

  Dim oSheet
  oSheet = ThisComponent.Sheets(0)
oSheet.getCellByPosition(0, 0).setValue(oSheet.getCellByPosition(1, 0).getValue())

Note, cell (0,0) is A1 and (1,0) is B1.


My guess is that the problem goes away. I think that it is related to what has the focus and how you issue the dispatch.

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to