Could it be that Win32::OLE doesn't know the Word constants? e.g. wdDoNotSaveChanges
Seems to work fine. (Even if Document.Words.Count isn't what I thought :-) Do ALT+F11 in Word for the VB Help/Designer.#!C:/ActivePerl/bin/perl.exe -w use strict; use Win32::OLE; my $word_app = Win32::OLE->new("Word.Application") or die ("Didn't create Word App.\n"); my $file="F:/test.doc"; my $word_file = $word_app->Documents->Open($file) or die ("Didn't manage to create a document object.\n"); print "File $file has " . $word_file->Words->Count . " words in it.\n"; $word_file->Close(0); #SaveChanges:=False $word_app->Quit; #SaveChanges not needed as files closed.
In reply to Re: OLE word problem
by Anonymous Monk
in thread OLE word problem
by banduwgs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |