Problem using SaveAs method

S

Sujata

Hi,

I'm running a perl script which uses Win 32 OLE package for Excel
operations. The script does some processing and populates a spreadsheet,
after which it uses the 'SaveAs' method to save it as xls in the same folder
in which the tool runs.
This used to work fine until recently I upgraded from MS Office 2003 to MS
Office 2007 version 12.0.6524.5003. Now, the script does not produce any xlsx
file at all.
I tried the same on another machine running Excel 2007 version
12.0.4518.1014, and surprisingly it generated the xlsx.

Is this some known issue with this version of Excel ? Pls suggest what
needs to be done.....I need to get this sorted very urgently.
 
B

Bob Umlas, Excel MVP

Check your setting in the Save section of Office/Excel Options -- the file
format you specify to save files in determines the default file type. Ensure
that's xlsx (or xlsm).
 
S

Sujata

In the SaveAs method, I tried specifiying the destination file extension
(xlsx - for excel version greater than 11.0 , and xls - for 11.0 and below
versions ) along with the respective fileformat parameters (51 & 56) . But ,
it still fails to generate the xlsx document with Office 2007 version
12.0.6524.5003. Pls advise.

Thanks,
Sujata
 
S

Sujata

Went through the link : link : http://www.rondebruin.nl/saveas.htm
The syntax - ActiveWorkbook.SaveAs "C:\ron.xlsm", fileformat:=52 - cannot be
directly used in my case as I'm using Win32 OLE in Perl. Below is a code
snippet from my perl script.

use Win32::OLE;
$excel = new Win32::OLE('Excel.Application', \&XLS_QuitApp);
$workbook = $excel->Workbooks->Add();
$workbook->SaveAs({FileName => $xls, FileFormat => 51});

I've tried doing a SaveAs with FileFormat 51 , but it fails to create an
xlsx. Even experimented with other fileformats like : 56 (xlEccel8), -4143
(xlNormal) and 50 (xlExel12)), but none of them worked.

Is it that the way I'm using OLE in Perl will no longer work for Excel 2007
? Will I need to start using a completely different package to support my
script on Office 2007 (for Excel 2007 ) ?

I'm looking for immediate help in this direction. Can you pls advise ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top