Quoting Glen Plantz <[EMAIL PROTECTED]>:

> Hi Folks,
>
> I'm getting an error when I try to execute the "SaveAs" function in
> Win32::OLE" when I try to save an Excel worksheet to a new format.
>
>  ( I'm using the " csv " format here, but I _really_ want to save each
> sheet in the workbook as a Tab delimited file, I could not find any
> format strings that looked like they would save to a tab delimited file
> )
>
> Here is the text of the error;
>
>  "Invalid number of parameters"
>     in METHOD/PROPERTYGET "SaveAs"
>
> I've searched for examples of executing this call, but I haven't found
> anything that works.
>
> Here is a snippet of code showing my execution:
>
> #
> ************************************************************************
> ***********************************************************************
>       my $count = $excel_Workbook->Worksheets()->{Count};
>       print "count = $count\n";
>       my $sheetName;
>       my $newEmailFileName;
>       my $newFileFormat = 'xlCSVMDOS';
>       my $newFile;
>
>       foreach (1..$count) {
>
>           my $currSheet2 = $excel_Workbook->Worksheets($_);
>           $sheetName = $currSheet2->{Name};
>           print "Sheet Name = $sheetName\n";
>
>           $newEmailFileName = "$Drive" . ':' . '\\' . "$Directory"
> .'\\' .'AmFam' . "$currentMonth" . "$year" . '_' . "$sheetName";
>
>           $newFile = "$Drive" . ':' . '\\' . "$Directory" .'\\'
> .'AmFam' . "$currentMonth" . "$year" . '_' . "$sheetName" . ".csv";
>
>           $currSheet2->SaveAs( $newEmailFileName, $newFileFormat,
> undef, undef, undef, undef, undef, undef, undef, undef );
>

Try:
$currSheet2->SaveAs({Filename =>$newEmailFileName,
               FileFormat => xlCSV});

>           if( Win32::OLE->LastError() ) {
>              print $sheetName . ' Error saving: ' .
> Win32::OLE->LastError() .
>           "\n"; }
>
>       }
>
> #
> ************************************************************************
> *********************
>
> Could some kind soul help me with this?
>
> Thanks in advance for any tips.
>
> Glen Plantz
>

Nathaniel Bartusiak

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to