I'm writing a perl script to handle a CGI request.  The script needs to
create a MS Word document on the fly so I'm using Win32::OLE to automate
Word.  For the CGI part I use the CGI package.

I am able to make the script work just fine from the command line but when I
try to use it as a CGI script I get an error from the Win32::OLE package. 
The error message returned by LastError say "Incorrect Function".

The web server I want this on is IIS on an NT 4.0 box.  The office 97 SR1
has been installed.

I wrote the following small test case and this exhibits the same behavior. 
I have checked the permissions of winword.exe on the server and it shows
full access for Everyone.

What am I missing or doing wrong?

Thanks.

-Mike Noel

-----------------------------------------

use CGI;
$q = new CGI();

print $q->header();
print "<body>\n";
print "Trying to start Word<p>\n";

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';
$Word = Win32::OLE->new('Word.Application','Quit')
or OLEError("Couldn't run Word");
$Word->Quit();

print "Started and stopped Word<p>\n";
print "</body>\n";
exit;

sub OLEError {
my($msg) = shift;
my($oleerror);

$oleerror = "" . Win32::OLE->LastError();
$msg = "$msg: $oleerror";
print "$msg\n";
}


______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to