in reply to Win32::OLE Excel Conditional Formatting error

The VBA macro shows Type:=xlCellValue ; in your perl code, you instead have Type => "xlCellValue". The string "xlCellValue" is not the same as the constant xlCellValue

To gain access to the xl* family of constants, Win32::OLE::Const allows you to

use Win32::OLE::Const 'Microsoft Excel';

To use those constants in your call, you need to run

$rangeFormat->FormatConditions->Add({Type=>xlCellValue, Operator=>xlNo +tEqual, Formula1=>"=TRUE"})

When I made those two changes to your code, I was able to see conditional formatting in the spreadsheet your code created.

Replies are listed 'Best First'.
Re^2: Win32::OLE Excel Conditional Formatting error
by slick.user (Acolyte) on Feb 29, 2024 at 21:32 UTC
    Thanks. I used Danny's solution. Win32::OLE::Const 'Microsoft Excel'; has to be on Win32 Excel only. I'm using Win64 Excel version.