Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You do not need quotes around the SUM range. It should be explicit:</p> <pre><code>=SUMME(R[-3]C:R[-1]C) </code></pre> <p>Additional point - your IF/WENN formula is incorrect. It is trying to compare the string "RC[-1]" to the number 5 and coming up with YES! THE STRING IS GREATER. It is not doing what you think it is doing... you should take out the quotes around the references here as well.</p> <p><strong>EDIT:</strong> Here's my version of you code, which runs without any errors. Changes are commented. Had to apply a few changes for the English version of Excel. Ran against <em>ActivePerl 5.10.1 Build 1006</em>.</p> <pre><code>#!C:\Perl\bin\perl.exe use warnings; use strict; # CHANGE - empty qw caused compilation error use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $xl = Win32::OLE::Const -&gt; Load( 'Microsoft Excel' ); # CHANGE - set path my $excelfile = 'C:\win32_ole_excel.xls'; my $excel = Win32::OLE -&gt; GetActiveObject( 'Excel.Application' ) || Win32::OLE -&gt; new( 'Excel.Application', 'Quit' ) or die $!; my $workbook = $excel -&gt; Workbooks -&gt; Add(); my $sheet = $workbook -&gt; Worksheets( 1 ); $sheet -&gt; Activate; $sheet-&gt;Range( 'A3' )-&gt;{Value} = 10; # CHANGE - Use IF, use commas, took quotes out around range $sheet-&gt;Range( 'B3' )-&gt;{FormulaR1C1} = '=IF( RC[-1] &gt; 5, OK, Not OK)'; # IF(,,); workes fine $sheet-&gt;Range( 'G1' )-&gt;{Value} = 3; $sheet-&gt;Range( 'G2' )-&gt;{Value} = 7; $sheet-&gt;Range( 'G3' )-&gt;{Value} = 6; # CHANGE - Use SUM, took quotes out around range $sheet-&gt;Range( 'G4' )-&gt;{FormulaR1C1} = '=SUM(R[-3]C:R[-1]C)'; # SUM(); doesn't work $workbook -&gt; SaveAs( { Filename =&gt; $excelfile, FileFormat =&gt; xlWorkbookNormal } ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload