in reply to Re: Need help converting Excel color scale conditional formatting macro to perl
in thread Need help converting Excel color scale conditional formatting macro to perl

Poj, I did have to make a couple of changes for the example you so wonderfully provided to work on my machine.

For the lines setting the Type, like this one: $csc->{1}->{'Type'} = xlConditionValueLowestValue; I needed to put quotes around the value like this: $csc->{1}->{'Type'} = 'xlConditionValueLowestValue';

When I used this line to start Excel: my $excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); I got this error:

Win32::OLE(0.1709) error 0x80020005: "Type mismatch" in PROPERTYPUT "Type" at OleExcelTipsTricks3.pl line 42.
However, no other code changes were needed if I launched Excel this way: my $excel = CreateObject OLE "Excel.Application";

No clue yet, why the difference in launching Excel mattered in my case, but just wanted to share that in case it matters for someone else.