in reply to Re: Perl OLE Excel Sort By Color
in thread Perl OLE Excel Sort By Color

Hi, The current converted code I have is
my $sheet1 = $workbook->Worksheets(1)->{Name}; $sheet1=$workbook->Worksheets($sheet1); $sheet1->Activate; my $rows=$sheet1->UsedRange->Rows->{'Count'}; $sheet1->Sort->SortFields->Add($sheet1->Range("A2:A" . $rows),xlSortOn +CellColor, xlAscending, xlSortNormal)->SortOnValue->{Color} = RGB(255 +, 0, 0);
I am getting the error on RGB, and I don't know what is the replacement for it in Perl. Kindly help.

Replies are listed 'Best First'.
Re^3: Perl OLE Excel Sort By Color
by hdb (Monsignor) on Jun 02, 2015 at 13:43 UTC

    Looking at Corion's google search I found this link where someone claims that

    RGB(a,b,c)=a*1+b*256+c*256^2

    Easy enough to translate into Perl:

    sub RGB { my ( $red, $green, $blue ) = @_; return $red + ($green<<8) + ($blue<<16); }
Re^3: Perl OLE Excel Sort By Color
by Corion (Patriarch) on Jun 02, 2015 at 13:03 UTC