* Marc Santhoff <[EMAIL PROTECTED]> [010605, 20:31]:
> Am Mittwoch, den 01.06.2005, 20:06 +0200 schrieb Ennio-Sr:
> [...]
> > >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$
>
> What are you trying to do here, delete the named range? Is "erase" a
> function in your program?
>
> oRanges.removeByName(sName$)
>
> should do, see IDL-reference for "com.sun.star.sheet.XNamedRanges".
>
Oh, thank God, that was it! Now my macro works like a charm :-)
Thank you very much indeed, Marc. "Erase" was not my function, but just a
(wrong) substitute for the missing correct instruction you suggested and
that I've been looking for in the last couple of days.
The code I submitted was a "dumb" code just to see what was happening ;)
BTW, where can I find the IDL-reference for
"com.sun.star.sheet.XNamedRanges" ?
Thans again,
Ennio.
--
[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]