The macro is from a chapter that I am considering placing a new book, but I might just release it as is... Have not decided if I have time to finish another book.

Ennio-Sr wrote:

Hi Andrew,
thanks for your quick reply.
I tried a few of your suggestions this night without getting any result; but 
they do work now (may be I was too tired ;) )

* Andrew Douglas Pitonyak <[EMAIL PROTECTED]> [280505, 18:56]:
Ennio-Sr wrote:

Hi all,
I'm wondering whether it is possible to delete/create named ranges
by a macro.
[skip]

Is this enough to get you started?


Perhaps too much :-)

In a macro, a named range is accessed, created, and deleted using the NamedRanges property of a Calc document. Use the methods hasByName(name) and getByName(name) to verify and retrieve a named range. The method
[skip]

*REM I could obtain the cell address by obtaining the cell*

*REM and then extracting the address from the cell.*

This is exactly what I need.
How can I extract the cell address after the cursor has been positioned onto
a cell?

[...]

The following do not seem to be strictly necessary (or am I loosing some big
point?)

*REM com.sun.star.sheet.NamedRangeFlag.FILTER_CRITERIA = 1*

*REM com.sun.star.sheet.NamedRangeFlag.PRINT_AREA = 2*

*REM com.sun.star.sheet.NamedRangeFlag.COLUMN_HEADER = 4*

*REM com.sun.star.sheet.NamedRangeFlag.ROW_HEADER = 8*


*oRanges.addNewByName(sName$, "$Sheet1.$B$3:$D$6", oCellAddress, 0)*
                                        ^^^^^^^^^
The pointer is already on a cell (variable position: last row of the
file): what shall I put here?

*End If*

*oRange = ThisComponent.NamedRanges.getByName(sName$)*

*REM Print the string contained in cell $Sheet1.$B$3*

*Print oRange.getReferredCells().getCellByPosition(0,0).getString()*

I skipped this as well and seems to work.
*End Sub*

The method addNewByname() accepts four arguments; the name, content, position, and type. The fourth argument to the method addNewByName() is a combination of flags that specify how the named range will be used (see Table 2)?the most common value is 0.

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php

Thanks,
     Ennio.



--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to