Thanks for the example, even if I already got the same answer (without an
example).

By the way, I have seen in most BASIC code that people put an o in the
beginning of variable names for objects and other characters for other
types. I suppose these are only some kind of recommendations, but it would
be nice to know what the recommendations are. Is there a list of those
somewhere? Maybe someone could send me a link?

It looks like it's obvious most of the time, but suddenly (for example in
Andrew Pitonyak's Macro document) there are cases where n seems to mean
Integer and I have seen o, v, m and s for Variant. That's why I'm asking...

Johnny


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

Hi Johnny,

Alle 13:04, sabato 27 gennaio 2007, Johnny Andersson ha scritto:
> Hi!
>
> Sorry for bothering again...
>
> When I delete the contents of a cell in a macro (for a spreadsheet
> document) I just set ThisComponent.Value to 0 and .String to "" and
maybe
> also Formula to "" for each cell.
> Is there a quicker way to do this, requiring only one instruction?
> I want to obtain the same result as the backspace key does to a selected
> cell  range.
>
> I recorded a macro when I deleted a cell range and the result looks like
> this:
[...]
> I guess I could shorten this quite a bit and still keep the
functionality,
> but isn't there an easier way?

You can also use "regular" Calc API's in this way:

REM  *****  BASIC  *****

Option Explicit

Sub TestClearContents
Dim oRange As Object
Dim iCellAttr As Integer

        iCellAttr = _
                com.sun.star.sheet.CellFlags.VALUE + _
                com.sun.star.sheet.CellFlags.DATETIME + _
                com.sun.star.sheet.CellFlags.STRING + _
                com.sun.star.sheet.CellFlags.ANNOTATION + _
                com.sun.star.sheet.CellFlags.FORMULA + _
                com.sun.star.sheet.CellFlags.HARDATTR + _
                com.sun.star.sheet.CellFlags.STYLES + _
                com.sun.star.sheet.CellFlags.OBJECTS + _
                com.sun.star.sheet.CellFlags.EDITATTR

        oRange = ThisComponent.Sheets(0).getCellRangeByName("A1:B4")
        oRange.ClearContents(iCellAttr)

End Sub



ciao
Paolo M

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


Reply via email to