On Wed, Jul 1, 2015 at 8:57 AM, Andrew Pitonyak <and...@pitonyak.org> wrote:
> 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. > Doing some googling this seems to explain what range is: https://msdn.microsoft.com/en-us/library/office/ff836512.aspx Just as Andrew mentioned, is the same as GetCellRangeBy[Position, Name]. > > 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: dev-unsubscr...@openoffice.apache.org > For additional commands, e-mail: dev-h...@openoffice.apache.org > > -- Alexandro Colorado Apache OpenOffice Contributor 882C 4389 3C27 E8DF 41B9 5C4C 1DB7 9D1C 7F4C 2614