On 30.06.2015 14:54, Mark Polczynski wrote:
I am an absolute beginner to OpenOffice macros, but have some knowledge of
VBA.  What is the OpenOffce macro equivalent of the VBA statement:

x = Range("Y")

Also, what is the equivalent of:

x = Cells(1,1)

Thanks!

Mark Polczynski


I assume that you posted this to the forum as suggested, but, I did not see your question there (it is a better place to answer these questions)

You get cells from the sheet containing them. I am unsure what Range("Y") does, but a rough guess is that it is a defined range.

So, if you just want the currently active sheet in a Calc document, you can do something like this:

ThisComponent.CurrentController.getActiveSheet()

If you want a specific sheet, you can use

ThisComponent.Sheets.getByIndex(<insert sheet index here>)
ThisComponent.Sheets.getByName(<insert sheet name here>)

Now, assume that you want cell A1, you can use

ThisComponent.CurrentController.getActiveSheet().getCellByPosition(0, 0)

The first 0 means the first column and the second 0 means the first row.

You can also use:

getCellByPosition(left, top) Get a cell within the range.
getCellRangeByPosition(left, top, right, bottom) Get a cell range within the range. getCellRangeByName(name) Get a cell range within the range based on its name. The string directly references cells using the standard formats — such as “B2:D5” or “$B$2” — or defined cell range names.

Hope this helps.

Oh, and you can find some examples here:

http://www.pitonyak.org/oo.php
http://www.pitonyak.org/AndrewMacro.odt
http://www.pitonyak.org/OOME_3_0.odt















---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to