Hi all!
I'm getting convinced that there is a bug in OOo.Calc preventing
deletion of named ranges from within a macro. However, being very new to
Basic language it might well be that my code is bugged instead ;)
Could some of you experts (Andrew ?) tell me what is wrong?
Thanks in advance.
Regards,
Ennio.
And this is the code code I wrote (always copying from Andrew' macros):
>Sub create_delete_range
>'----------------------
>Dim oRange 'The created range
>Dim oRanges ' All named ranges
>Dim sName$ ' Name of the named range to create
>Dim oActiveCell 'The current active cell
>oActiveCell = ThisComponent.CurrentSelection
>r$ = oActiveCell.celladdress.row+1
>dim xcl$
>xcl$ = "Sheet1.$F$"+r$ '[***]
>print xcl$
>sName$ = "last_bal"
>oRanges = ThisComponent.NamedRanges
>Dim oCellAddress As new com.sun.star.table.CellAddress
> oCellAddress.Sheet = 0 'The first sheet
>oRanges.addNewByName(sName$,xcl$,oCellAddress,0)
>oRange = ThisComponent.NamedRanges.getByName(sName$)
>Print oRange.getReferredCells().getCellByPosition(0,0).getString()
>If oRanges.hasByName(sName$) Then
>oRanges.getByName(sName$)
>Print sName$
>erase sName$
>Print sName$
>End If
>End sub
[***] I tested it in a 6 cols test spreadsheet (date, date, description,
debit, credit, balance) - both in OOo-1.1.4 and OOo.2Beta(1.9.82) under
GNU-Linux Debian Sarge - but you can verify it in a single col ss
changing the "Sheet1.$F$"+r$ for "Sheet1.$A$"+r$
> ^ ^
--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?//
Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (�|�)
[Why use Win$ozz (I say) if ... "even a fool can do that. )=(
Do something you aren't good at!" (as Henry Miller used to say) ]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]