in reply to Re: Problem using SaveAs when trying to change Excel format
in thread Problem using SaveAs when trying to change Excel format

Thanks. That fixed it

  • Comment on Re^2: Problem using SaveAs when trying to change Excel format

Replies are listed 'Best First'.
Re^3: Problem using SaveAs when trying to change Excel format
by Anonymous Monk on Jul 09, 2014 at 05:41 UTC

    Hi, I' new to perl. I'm appending a row in the excel file. But a pop comes out(to save the temp file) while saving a file. Below is the code I'm using to do the same.

    my $Excel = Win32::OLE->GetActiveObject('Excel.Application') | +| Win32::OLE->new('Excel.Application'); $Excel->{'Visible'} = 0; #0 is hidden, 1 is visible $Excel->{DisplayAlerts}=0; #0 is hide alerts # Open File and Worksheet util->logit("[$PARENT_PROC_NAME]: in_file[$in_file]"); my $Book = $Excel->Workbooks->Open($in_file); # open Excel file my $sheetcount = $Book->Worksheets->Count; #util->logit("[$PARENT_PROC_NAME]: sheetcount[$sheetcount]"); foreach my $i (1 .. $sheetcount) { #util->logit("[$PARENT_PROC_NAME]: i value [$i]"); my $Sheet = $Book->Worksheets($i); if(defined($Sheet)) { util->logit("[$PARENT_PROC_NAME]: Sheet[$Sheet]"); my $LastRow = $Sheet->UsedRange->Row + $Sheet->UsedRange-> +Rows->Count - 1; util->logit("[$PARENT_PROC_NAME]: LastRow[$LastRow]"); $Sheet->Cells($LastRow+1,1)->{Value} = localtime; } } #$Book->SaveAs(Filename =>$in_file); #my $file_ointer = $Book->Save(); #$Book->SaveAs(); $Book->SaveAs(); $Book->Close(); $Book->Quit(); undef $Book;

    I need to save the changes without any manual efforts... Kindly suggest something. Thanks in advance.

      Why don't you try giving SaveAs parameters exactly like in the OP?

        OP?? I'm sorry. kindly explain.