in reply to Snarfing data from microsoft word
#!/usr/bin/perl -w # Uses use strict; use Win32::OLE; use Win32::OLE::Const; # Create MSWord object and load constants my $MSWord = Win32::OLE->new('Word.Application', 'Quit') or die "Could not load MS Word\n"; my $wd=Win32::OLE::Const->Load($MSWord); # Open document (full path) my $doc = $MSWord->Documents->Open('c:\full\path\to\document.doc'); # Ask word to print the contents of a field named "TheFieldIWant" print $doc->FormFields("TheFieldIWant")->Result,"\n"; # Close document (without save) $doc->Close({SaveChanges=>$wd->{wdDoNotSaveChanges}});
|
---|