in reply to FormatConditions Error

The OP probably doesn't need this anymore, but since I couldn't find anything on the topic myself, here's what I came up with. There are two major problems with the OP's code, plus a minor typo.

Problem 1: xlCellValue and xlExpression have to be barewords, not strings. For that to work, we need use Win32::OLE::Const 'Microsoft Excel';, which was probably set correctly anyway.

Problem 2: Multiple parameters for VBA (or OLE, I'm not certain which is correct to say here) functions can't just be listed, we have to use dictionaries with named parameters. The parameter names can be found in the VBA help that comes with the VB editor in MS Office, for example. The first, mandatory, parameter precedes that dictionary (or "can precede", I'm not certain here).

So, the working code should look something like the following:

use Win32::OLE::Const 'Microsoft Excel'; [...] my $Range = $Book->Worksheets('Name')->Range("H1"); $Range->FormatConditions ->Delete; $Range->FormatConditions->Add(xlTextString, { String => "finished", TextOperator => xlEndsWith }); $Range->FormatConditions(1)->Interior->{ColorIndex} = 3; $Range->FormatConditions(1)->Font->{ColorIndex} = 2; $Range->FormatConditions->Add(xlTextString, { String => "in progress", TextOperator => xlEndsWith }); $Range->FormatConditions(1)->Interior->{ColorIndex} = 3; $Range->FormatConditions(1)->Font->{ColorIndex} = 5;

This is not the OP's formatting condition, since I didn't want to look up the parameter names needed for that. It should be fairly simple to adapt this to your needs.