CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
%1 is not a valid Win32 application.

 



random1102
New User

Aug 31, 2010, 9:08 PM

Post #1 of 1 (7794 views)
%1 is not a valid Win32 application. Can't Post


Code
#!/usr/bin/perl -w 

use strict;
use OLE;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';

$Win32::OLE::Warn = 3; # die on errors...
print "Content-type: text/html\n\n";

print "init <BR>";
my $Excel = CreateObject OLE 'Excel.Application';
print "excel init_ <BR>";
my $Book = $Excel->Workbooks->Open("D:/template.xls");
print "excel file loaded <BR>";

my $Sheet = $Book->Worksheets(1);

foreach my $row (1..9)
{
foreach my $col (1..3)
{
next unless defined $Sheet->Cells($row,$col)->{'Value'};
printf "At ($row, $col) the value is %s and the formula is %s\n",
$Sheet->Cells($row,$col)->{'Value'},
$Sheet->Cells($row,$col)->{'Formula'};
}
}

$Sheet->Cells(6, 1)->{'Value'} = 'MODTEST';
print "excel file modified <BR>";
$Book->SaveAs({Filename =>'D:/record.xls',
FileFormat => xlWorkbookNormal});
print "excel file saved <BR>";

$Book->Close;
$Excel->Quit();

print "excel quit successfully<BR>";


The script runs fine when i run it straight from command prompt
But when i run it on the site
it throws me the error
-> %1 is not a valid Win32 application.

Anyone encounter this errror before ?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives