Thanks!

I have downloaded it and I will try it as soon as possible.

By the way, do you happen to know if there is a better way to check if a
cell range is empty than the following?

Dim Blah As Variant
Blah=ThisComponent.Sheets.getByIndex
(0).getCellRangeByPosition(0,2,1,2).getDataArray()
If IsEmpty(Blah) Then
  {Do something}
EndIf

I am looking for something like the following, which doesn't seem to exist:
If ThisComponent.Sheets.getByIndex(0).getCellRangeByPosition(0,2,1,2).IsEmpty()
Then
  {Do something}
EndIf

or perharps
If IsEmpty(ThisComponent.Sheets.getByIndex(0).getCellRangeByPosition(0,2,1,2))
Then
  {Do something}
EndIf

I guess that won't work either since IsEmpty only works for the Variant
type.



Johnny


2007/1/27, Paolo Mantovani <[EMAIL PROTECTED]>:

Alle 13:04, sabato 27 gennaio 2007, Johnny Andersson ha scritto:
[....]
> I recorded a macro when I deleted a cell range and the result looks like
> this:
[....]

Just for info: if you often use the macro recorder for your macro
projects,
perhaps you may want to try the DispatchToAPI recorder, an alternative
macro
recorder (for Calc) that generate API based code.

For example, the macro that you have recorded in order to select a range
and
delete it's content would appears like the following (just recorded by
me):

---------------------------------------------------
REM  *****  BASIC  *****

sub Main
' Recorded by Paolo Mantovani
' Date: Sat Jan 27 14:39:34 2007

        ' get access to the document
        oDocumentModel = ThisComponent
        oDocumentView = oDocumentModel.getCurrentController()
        oDocumentFrame = oDocumentView.Frame

        ' the dispatcher service is used to send commands from the
        ' document frame to the underlaying office application
        oDispatcher = CreateUnoService("com.sun.star.frame.DispatchHelper
")

        oCellRange = oDocumentView.ActiveSheet.getCellRangeByName("A5:B6")
        oDocumentView.select(oCellRange)

        iContentType = com.sun.star.sheet.CellFlags.STRING + _
                com.sun.star.sheet.CellFlags.VALUE + _
                com.sun.star.sheet.CellFlags.DATETIME + _
                com.sun.star.sheet.CellFlags.FORMULA + _
                com.sun.star.sheet.CellFlags.ANNOTATION + _
                com.sun.star.sheet.CellFlags.FORMATTED + _
                com.sun.star.sheet.CellFlags.OBJECTS

        oDocumentView.Selection.ClearContents(iContentType)

end sub


The dispatchToAPI recorder is deployed as OOo extension and is freely
available from here:

http://www.paolo-mantovani.org/downloads/DispatchToApiRecorder/

You need also to install at least one "transformer" (currently there is
only a
Calc Transformer)
The transformer is also an extension and is the component that actually
makes
the Dispatch-to-API translation of the macro code

http://www.paolo-mantovani.org/downloads/DispatchToApiRecorder/transformers/

After the installation, you do not need to know anything else:
reboot openoffice and just use the macro recorder as usual.

If you want to switch back to the "classic" macro recorder you have only
to
remove or disable both extensions from the extension manager dialog.

Feel free to contact me for any further information

ciao
Paolo M


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


Reply via email to