Paolo Mantovani wrote:
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

Hi. I trust you do not object to my quoting part of the above explanation in the Help sticky in the forum (and in another posting). I installed the packages many months ago and did not see how to use them. (The explanations may be in the Install.txt documents - I don't recall.)

Regards.

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

Reply via email to