OpenOffice.org OpenOffice - 3.3 Guía básica Pagina 312

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 434
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 311
REM Select the range to sort.
REM The only purpose would be to emphasize the sorted data.
'ThisComponent.getCurrentController.select(oCellRange)
REM The columns are numbered starting with 0, so
REM column A is 0, column B is 1, etc.
REM Sort column B (column 1) descending.
oSortFields(0).Field = 1
oSortFields(0).SortAscending = FALSE
REM If column B has two cells with the same value,
REM then use column A ascending to decide the order.
oSortFields(1).Field = 0
oSortFields(1).SortAscending = True
REM Setup the sort descriptor.
oSortDesc(0).Name = "SortFields"
oSortDesc(0).Value = oSortFields()
REM Sort the range.
oCellRange.Sort(oSortDesc())
End Sub
As this macro is a subroutine, you execute it with Tools > Macros > Run Macro
and then open CalcTestMacros > AuthorsCalcMacros > Module1. Click on the
macro SortRange and then Run.
Conclusion
This chapter provides a brief overview on how to create libraries and modules, using
the macro recorder, using macros as Calc functions, and writing your own macros
without the macro recorder. Each topic deserves at least one chapter, and writing
your own macros for Calc could easily fill an entire book. In other words, this is just
the beginning of what you can learn!
312 OpenOffice.org 3.3 Calc Guide
Vista de pagina 311
1 2 ... 307 308 309 310 311 312 313 314 315 316 317 ... 433 434

Comentarios a estos manuales

Sin comentarios