Hello, I have included the sub function that handles the excel file. The nasty thing is that I am facing this error only when running with limmited access rights (basic user rights). So I believe that the perl script is not the blame, because when I call it from batch it works fine.
sub generate_reports { LogStart(); $Excel = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;}); ###### handling of files my @file_parts = split (/\//,$warning_files[0]); my $file = $file_parts[-1]; chomp($file); $file =~ s/\r//g; $file =~ s/\.txt//g; my $xls_filename = "$xls_files[0]"; open XLSFILE, $xls_filename or my $flag_die = 1; close XLSFILE; if ($flag_die eq 1) { printf ("\nDEBUG: Excel is: $Excel"); printf ("\nDEBUG: template_path is: $template_path"); #$template_path =~ s/\r//g; #$template_path =~ s/^\s*//g; #$template_path =~ s/\s*$//g; #$template_path =~ s/\//\\/g; #printf ("\nDEBUG: template_path (modified) is: $template_path\n"); $Excelbook = $Excel->Workbooks->Open("$template_path.\\filereport.xls" +); printf ("\nDEBUG: xls_filename is: $xls_filename\n"); #$xls_filename =~ s/\r//g; #$xls_filename =~ s/^\s*//g; #$xls_filename =~ s/\s*$//g; #$xls_filename =~ s/\//\\/g; #printf ("\nDEBUG: xls_filename (modified) is: $xls_filename\n\n"); printf ("\nDEBUG: Excelbook is: $Excelbook\n"); $Excelbook->SaveAs($xls_filename); } else { # file exists -> open it for update if (!(-w $xls_filename)) { printf ("\n$xls_filename is write-protected and can't be cr +eated."); die; } $xls_filename =~ s/\r//g; # remove control characters $xls_filename =~ s/^\s*//g; # Kill leading blanks $xls_filename =~ s/\s*$//g; # Kill trailing blanks $xls_filename =~ s/\//\\/g; # replace "/" by "\" $Excelbook = $Excel->Workbooks->Open($xls_filename); } my $firstSheet = $Excelbook->Worksheets(2); # activate warning sheet $firstSheet->Activate(); $Report_Sheet = $firstSheet;

In reply to Re^2: cygwin, make, perl, win32::ole (excel) problem by cugetare
in thread cygwin, make, perl, win32::ole (excel) problem by cugetare

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.