Hi all,

I have an excel sheet (extension .xlsm) with mutliple sheets and a lot of functions/formula's to be calculated using the inputparameters in the first sheet. That's why I'm using a Perl script to update the parameters in the first sheet and afterwards (re)calculate all values in all other sheets.

To (re)calculate the Excel sheet, I created the following macro:

Sub Recalc()
    Sheets("INPUT PAR").Cells(1, 7).Value = "START"
    Application.CalculateFull
    Sheets("INPUT PAR").Cells(1, 8).Value = "EINDE"
End Sub
If I execute this macro manually in the excel sheet, the recalculation runs successfully.

However, I want to call this macro from my Perl script which has the following code:

use Win32::OLE::Const 'Microsoft Excel';
my $file = "D:\\test.xlsm";

# Open Excel
my $excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit');
my $workbook = $excel->Workbooks->Open($file) or croak {message=>"FAILED TO OPEN $file"};
my $worksheet = $workbook->Worksheets(1);

# Do some updates in excel ...
$worksheet->cells(3,3)->{'value'} = "30/04/2013";
# (and more like this)

$workbook->Save;
$excel->Run('ThisWorkbook.Recalc');
$workbook->Save;
$workbook->Close;
The macro is excuted successfully, I see that the "BEGIN" and "END" is printed correctly in the right cells. These prints are in the macro, before and after the calculation function. However, the (re)calcalation doesn't seem to work as my functions/fomula's are not recalculated.

I hope somebody can help me?