Spotty access to email and short on time....
The included help does not include API level documentation since most
people have no need for it.
Sadly, I have no ability at the moment to generate an example, but, you
can find numerous examples in AndrewMacro.odt for this. I believe that
there will be a better explanation in OOME as available on my web site. If
you download that and it does not yet contain Calc examples, shoot me a
private email and I will push a copy that (although incomplete) will
contain an example of how this is done.
In brief, the idea is that you:
1. Obtain a reference to the document. If it is the current document, then
you can use the variable "ThisComponent".
2. Get a reference to the sheet containing the cell. In most cases, you
can do something like the following:
ThisComponent.sheets.getByIndex(0) ' Get the first sheet
ThisComponent.sheets.getByName("Investments") ' Get a sheet by name
Sometimes you simply want to get the currently active sheet, which is a
bit more difficult. It probably looks something like the follow (from
memory so I am probably wrong).
ThisComponent.CurrentController.ActiveSheet
After you have the sheet, then you can get the cell. Again, this is all
from memory, so I am likely totally wrong, but it probably looks something
like:
oSheet.getCellByPosition(1,2) 'Cell B3
oSheet.getCellRangeByName("B3")
A cell range with a single cell returns that cell I believe.
Next, you must decide how to get the contents of the cell. Do you want the
contained formula, a numeric value, or a string representation?
Oh, and David, I copied you with a BCC because I do not know if my post to
the list will go through based on the credentials used to send this email.
Andrew Pitonyak
On Sun, 30 Oct 2011 11:13:40 +0000 (GMT), Tom Davies
<tomdavies04@yahoo.co.uk> wrote:
Hi :)
There are various books and guides about Macros. I've been told by
various people that Andrew Pitonyak's is excellent. Hopefully the link
is
on this page
http://wiki.documentfoundation.org/Documentation/Publications
I'm not sure if that will help with the specific problem as we might
need
to collect links to more external resources onto that page.
Regards from
Tom :)
--- On Sat, 29/10/11, David S. Crampton <david_crampton@ie2b.com> wrote:
From: David S. Crampton <david_crampton@ie2b.com>
Subject: [libreoffice-users] How may I read the value of a cell into a
macro variable?
To: users@global.libreoffice.org
Date: Saturday, 29 October, 2011, 0:44
This question has two parts: simple
and more complex:
simple: I wish to read the value of the currently selected
cell (in Calc, of course) into a variable in the macro
language (Libre Basic). Script example please. and
thank you!
more complex: AFAIK the LibreHelp does not document the
stuff like:
dispatcher.executeDispatch(document, ".uno:GoToCell", "",
0, args2())
I used to be pretty skilled at recording macros and then
modifying them. Where do I go to find things related to
"uno:GoToCell"? Universal Network Objects? Can't
find the "starting point".
Thank you for an orientation,
--David S. Crampton
--For unsubscribe instructions e-mail to:
users+help@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
--
For unsubscribe instructions e-mail to: users+help@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
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.