JaySal has asked for the wisdom of the Perl Monks concerning the following question:
I have Excel 2007 installed but I need to save my excel file as a .xls, compatible with Excel 2003. My code doesn't seem to be working, it won't recongnize the SaveAs and prompts to save "Book1" any help would be appreciated
use Win32; use Win32::OLE; $excelFile = "c:\\perl\_scripts\\printVersions\\dest\\NMSPrintVersions +.xls"; $xlApp = Win32::OLE->new('Excel.Application'); $xlApp->{Visible} = 0; $xlBook = $xlApp->Workbooks->Add; $sheet = $xlBook->ActiveSheet; $range = $xlBook->ActiveSheet->Range("A1:C1"); $title = ["FILENAME","VERSION","DATEUPDATED"]; $range ->{value} = $title; $sheet->Columns("B:B") -> {NumberFormat} = "#0.0"; $count=1; foreach (@array) { ($one, $two, $three) = split('\,', $_); $mydata = ["$one", "$two", "$three"]; $count++; $range = $xlBook->ActiveSheet->Range("A$count:C$count"); $range->{Value} = $mydata } unlink ($excelFile); #$xlBook->SaveAs($excelFile); $xlBook->SaveAs({Filename=>"$excelFile",FileFormat=>xlExcel9795}); $xlBook->Close(); $xlApp->Quit();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE - Excel, Can't save as Previous Version
by dasgar (Priest) on Aug 25, 2011 at 16:01 UTC | |
by JaySal (Initiate) on Aug 26, 2011 at 17:03 UTC | |
by Anonymous Monk on Jul 26, 2012 at 22:49 UTC | |
|
Re: Win32::OLE - Excel, Can't save as Previous Version
by JaySal (Initiate) on Aug 25, 2011 at 13:56 UTC | |
by davies (Monsignor) on Aug 25, 2011 at 15:11 UTC |