Thanks very much for the help.

Kind regards
Filip Ruymen


On Tue, 15 Feb 2005 10:44:12 +1300, Ian Laurenson
<[EMAIL PROTECTED]> wrote:
> On Tue, 2005-02-15 at 01:17, Filip Ruymen wrote:
> > Since I know nothing about scripting, is it possible that anyone can
> > convert it for me so that it works with OpenOffice?
> [remainder snipped]
> I assume that the purpose of the macro is that there are more than 3
> conditions for changing the cells background colour and thus conditional
> formatting does not have sufficient conditions.
> I have not converted the commented out turning on and off of sheet
> protection. I have left the original VBA code but commented out so that
> direct comparisons can be made between VBA and OOo BASIC.
> 
> Sub Colors()
>   'ActiveSheet.Unprotect Password:=""
>   'Application.ScreenUpdating = False
>   thisComponent.lockControllers
>   oController = ThisComponent.CurrentController
>   oSheet = oController.ActiveSheet
>   oCells = oSheet.getCellRangeByName("B4:AF15")
>   'for each cell in selection
>   For i = 0 to oCells.rows.count - 1
>     for j = 0 to OCells.columns.count - 1
>       oCell = oCells.getCellByPosition(j, i)
>       Select Case UCase(oCell.string)
>         Case "B"
>           'cell.Interior.ColorIndex = 1
>           oCell.CellBackColor = 0       'Black
>         Case "F"
>           'cell.Interior.ColorIndex = 45
>           oCell.CellBackColor = 16750848        'Orange
>         Case "SV"
>           'cell.Interior.ColorIndex = 4
>           oCell.CellBackColor = 65280   'Green
>         Case "V"
>           'cell.Interior.ColorIndex = 33
>           oCell.CellBackColor = 52479   'Blue
>         Case "Z"
>           'cell.Interior.ColorIndex = 26
>           oCell.CellBackColor = 16711935        'Magenta
>         Case "R"
>           'cell.Interior.ColorIndex = 36
>           oCell.CellBackColor = 1677713 'Yellow
>         Case Else
>           'cell.Interior.ColorIndex = 50
>           oCell.CellBackColor = 3381606 'Dark green
>       End Select
>     Next
>   next
> '  Range("K21").Select
>   oController.select(oSheet.getCellRangeByName("K21"))
> '  Application.ScreenUpdating = False This should have been true!
>    thisComponent.unlockControllers
>   'ActiveSheet.Protect Password:="", DrawingObjects:=True,
> 'Contents:=True, Scenarios:=True
> End Sub
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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

Reply via email to