Ciao a tutti,

Una domanda semplice (e cosi' spero sia la risposta).

Per rispondere ad una richiesta sulla lista utenti di spostare la cella attiva sulla riga successiva a quella dove si trova la cella attiva e nella colonna B ho scritto questa macro elementare (soprattutto quando si puo' copiare da Paolo l'80% del codice :) ) Dopo aver ricavato l'indirizzo della cella di destinazione mi sono arenato in quanto riesco solo a selezionare la cella desiderata con
oSheet = thisComponent.getSheets.getByIndex(0)
oCell = oSheet.getCellByPosition(...)
thisComponent.getCurrentController().Select(oCell)

Son percio' ricorso al dispatcher che pero' so non essere molto popolare in questa lista...

La domanda: come si fa ad attivare una certa cella (bordo ingrossato) senza selezionarne il contenuto?

Grazie per l'attenzione

Michele


=======================================


Sub subCursorToNextRowColumnB()
   'the code to get the active cell has been copied from Mr Paolo Mantovani
   Dim oActiveCell    'The current active cell
   Dim oConv        'The cell addres conversion service
Dim lCurrentRow 'The 1-based index of the row where the active cell is
   Dim oDispatcher
   Dim sTargetCellAddress
'get the active cell!
   oActiveCell = thisComponent.getCurrentSelection()
'invoke the conversion service oConv = ThisComponent.createInstance("com.sun.star.table.CellAddressConversion")
   oConv.Address = oActiveCell.getCellAddress
'get the current row (the code fails if the cursor is on column AA or subsequent ones
   lCurrentRow = CLng( Mid( oConv.UserInterfaceRepresentation, 2 ) )
'now move to the next cell
   oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
sTargetCellAddress = "$B$" & CStr( lCurrentRow + 1 )
   dim args1(0) as new com.sun.star.beans.PropertyValue
   args1(0).Name = "ToPoint"
   args1(0).Value = sTargetCellAddress

oDispatcher.executeDispatch(thisComponent.getCurrentController().Frame, ".uno:GoToCell", "", 0, args1()) End Sub


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.0/248 - Release Date: 01/02/2006

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

Rispondere a