APM: (no subject)

Randall Hennig randysleek at hotmail.com
Thu Dec 11 17:01:37 CST 2003

Ok, been having a problem that I can not figure out.
Basically, I have a perl script that goes through and batch processes about 
200+ word documents,
converting them into text files (with some special formatting).

My problem is:  After processing about 20-30 word documents MS Word crashes 
and I have to open MS Word and exit it, which makes it close the 20-30 
documents.  Seems that even though I call the Close() method, it wants to 
keep those documents open.

So, I want to know how to make word close a document for real, because what 
I am doing does not seem to work.  BUT at the same time, I want to keep the 
Word application open and keep using it.

Here is the code I am using (please be nice to me, I'm still a perl 
novitiate :p):

sub processFile
  my ($input, $output) = @_;
  my $document = Win32::OLE -> GetObject( $input ) or return( &logError( 
"Error getting object:". Win32::OLE->LastError() ));
  open (FH,">$output") or die("Couldn't open file for output: \"$output\"");

  print "Process input file: \"$input\"\n";
  print "Created output file: \"$output\"\n";

  my ($paragraph, $text, $output);
  my $paragraphs = $document->Paragraphs();
  my $enumerate = new Win32::OLE::Enum($paragraphs);

  while(defined($paragraph = $enumerate->Next()))
    $output = &convertFormatting( $paragraph->{Range} );
    print FH $output . "\n";


Winterize your home with tips from MSN House & Home. 

More information about the Austin mailing list