Robert Volke wrote:

What exactly can you record a macro to do.  I have been trying to record
a macro to change the color of text and background for particular cells
but when I run the macro nothing happens.  I have tried this in both
versions 109 and 118 of OpenOffice on my NT box.  I have been only doing
this as a test but if this doesn't work, are there other problems with
the macro recording that anyone knows about?  I was able to write macros
like these in Microsoft.  Any light that can be shed on this matter will
be greatly appreciated.  Thanks,

Robert Volke

In general, the macro recorder does NOT record dialog activity. You set the colors using a dialog. Did you want to set the colors for specific cells, selected areas? The following macro will set the text color and the background color for the cells B1:B3 in the first sheet.

Option Explicit

Sub SetCellColors
 Dim oSheet
 Dim oRange
 oSheet = ThisComponent.getSheets().getByIndex(0)
 oRange = oSheet.getCellRangeByName("B1:B3")
 REM 10066431 is violet, -1 is default
 oRange.CellBackColor = 10066431
 REM 8388608 is Dark Red. -1 is default color.
 oRange.CharColor = 8388608
 'oRange.CellBackColor = -1
 'oRange.CharColor = -1
End Sub

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php


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

Reply via email to