greyhawk has asked for the wisdom of the Perl Monks concerning the following question:

I have a small perl program which uses win32::OLE to modify an existing Excel spreadsheet. Works perfectly, but when I compile it with perl2exe it does everything except actually write the changes into the spreadsheet. No error message but the spreadsheet remains unchanged. Can anyone help?

Replies are listed 'Best First'.
Re: win32::OLE problem with perl2exe
by Anonymous Monk on Mar 14, 2010 at 12:00 UTC
    No error message but the spreadsheet remains unchanged. Can anyone help?

    You can help yourself if you show a minimal example which demonstrates your problem (you're probably not error checking)

      OK. Here is an example. It creates an Excel spreadsheet called test.xls containing a single cell containing "success"

      It works fine (Windows XP Prof, Active State 5.10.1.1006) But if I produce example.exe using

      perl2exe -o=example.exe example.pl

      it doesn't produce test.xls

      use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Cwd 'abs_path'; use File::Glob; $root = abs_path($0); $root =~ s/[^\\]*$//; $Win32::OLE::Warn = 3; my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{DisplayAlerts}=0; my $Bookout = $Excel->Workbooks->Add(); $Bookout->SaveAs("${root}test.xls"); my $Sheetout = $Bookout->Worksheets(1); $Sheetout->Cells(1,1)->{'Value'}="Success"; $Bookout->Save; $Bookout->Close; $Excel->Quit; exit;