* Ennio-Sr <[EMAIL PROTECTED]> [290505, 17:10]:
> 
> * Andrew Douglas Pitonyak <[EMAIL PROTECTED]> [280505, 18:56]:
> > 
> > [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?
> 
> > [...] 
> 

I went on trying, after I read section 6.5 of your Macro Info doc. but
having no idea of what all those command precisely mean, I'm still far
from my goal ;(
May be you could help me better looking at what I wrote:

------ quote ------
- sub create_last_bal
- ===================
- dim document   as object
- dim dispatcher as object
- document   = ThisComponent.CurrentController.Frame
- dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
- dim args1(0) as new com.sun.star.beans.PropertyValue
- args1(0).Name = "ToPoint"
- args1(0).Value = "$F$6"
- dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
- dim args2(1) as new com.sun.star.beans.PropertyValue
- args2(0).Name = "By"
- args2(0).Value = 1
- args2(1).Name = "Sel"
- args2(1).Value = false
- dispatcher.executeDispatch(document, ".uno:GoDownToEndOfData", "", 0, args2())
                                        ^^^^^^^^^^^^^^^^^^^^^^
- This last cell is the one I want to be referred to by the named range
rem -------- [I added this after your post and reading sect. 6.5 (p. 91)] 
- Dim oRange 'The created range
- Dim oRanges ' All named ranges
- Dim sName$ ' Name of the named range to create
rem ---------- [Added after reading p.91 sect 6.5]
- Dim oActiveCell 'The current active cell
- Dim oRanges2
- Dim oConv
- oRanges2 = ThisComponent.createInstance("com.sun.star.sheet.SheetCellRanges")
- ThisComponent.CurrentController.Select(oRanges2)
- oActiveCell = ThisComponent.CurrentSelection
- oConv = 
ThisComponent.createInstance("com.sun.star.table.CellAddressConversion")
- oConv.Address = oActiveCell.getCellAddress
rem ----------
- sName$ = "last_bal"
- oRanges = ThisComponent.NamedRanges
- If NOT oRanges.hasByName(sName$) Then
- Dim oCellAddress As new com.sun.star.table.CellAddress
- oCellAddress.Sheet = 0 'The first sheet
- oRanges.addNewByName(sName$, oActiveCell,oCellAddress,0)    
- rem oRanges.addNewByName(sName$,"$Sheet1.$F$15",oCellAddress,0)
- If I put the fixed ref. it works
- End If
- oRange = ThisComponent.NamedRanges.getByName(sName$)
- end sub
--------------- unquote -----------

Regards,
       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]

Reply via email to