Article View: microsoft.public.win32.programmer.ole
Article #27PB Opening word file with perl...Win32::OLE
From: Olivier Maas
Date: Fri, 25 Jun 1999 00:00
Date: Fri, 25 Jun 1999 00:00
63 lines
2410 bytes
2410 bytes
Hello
Here is a little piece of code:
##################################################
use Win32::OLE;
$application=Win32::OLE->GetActiveObject('Word.Application');
print "step 1";
unless (defined $application)
{
$application=Win32::OLE->new('Word.Application', 'Quit') || warn
"Impossible de créer un objet OLE";
print "step 2";
$CloseWhenGoingOut=1;
}
print "step 3 $fichier $application<BR>\n";
$document=$application->Documents->Open("$fichier");
print "step 4 <BR>\n $NomFichLocal <BR>\n $CloseWhenGoingOut $document
av\n";
$res= $document->{'Name'};#
print "$res step 1.5 \n";
$res=$document->SaveAs('c:\temp\testtest.txt',wdFormatText);
print "\n normally $res saved 2 \n";
$res= $document->Saved;
print "$res step 4.5 \n";
$res=$document->{'Name'};
print "$res step 5 \n";
$document->Close(0);
print "step 6\n";
$application->quit();
if (defined $CloseWhenGoingOut)
{
DESTROY ($application);
print "step 7";
}
#############################################
the $fichier looks allright (c:\InetPub\wwwroot\results\Or.doc)
the file exists and the same code works localy on my machine, but not on
the server.
the server (NT4) has Word and Excel installed, Active perl 5.09.
the error message goes :
Can't call method "SaveAs" on unblessed reference at assist.pl line
72...
I really cannot see what can go wrong...
any idears???
please also reply by email to maas@ensae.fr
olivier
passme
Technical Details
Message-ID:
<3773739B.5774F3F6@at-lci.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 112333,ec4cf2818ac70e6a,start X-Google-Attributes: gid112333,public X-Google-Thread: fa0ae,ec4cf2818ac70e6a,start X-Google-Attributes: gidfa0ae,public X-Google-Thread: fe15c,ec4cf2818ac70e6a,start X-Google-Attributes: gidfe15c,public From: Olivier Maas <olivier.maas@at-lci.com> Subject: PB Opening word file with perl...Win32::OLE Date: 1999/06/25 Message-ID: <3773739B.5774F3F6@at-lci.com> X-Deja-AN: 493748656 Content-Transfer-Encoding: 7bit X-Accept-Language: fr Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@oleane.net X-Trace: minus.oleane.net 930313252 30751 62.161.249.201 (25 Jun 1999 12:20:52 GMT) Organization: Guest of OLEANE Mime-Version: 1.0 Reply-To: maas@ensae.fr NNTP-Posting-Date: 25 Jun 1999 12:20:52 GMT Newsgroups: microsoft.public.win32.programmer.ole,fr.comp.lang.perl,comp.lang.perl.misc