fox8267 has asked for the wisdom of the Perl Monks concerning the following question:
---------------------------------------- #!perl -w use strict; use File::Find; find(\&save_as_html, "C:\\abc"); sub save_as_html { use Win32::OLE qw(in with); use Win32::OLE::Const; use Win32::OLE::Const 'Microsoft Word'; $Win32::OLE::Warn = 3; my $filename = $File::Find::name; my $savename = "$filename".".htm"; if (( -f $filename ) && (rindex (substr ($filename,-4,4),".doc") = += 0 )) { print "Starting word\n"; my $Word = Win32::OLE->GetActiveObject('Word.Application') or Win32::OLE->new('Word.Application', 'Quit'); $Word->{Visible}= 0; print "Opening $filename \n"; $Word->Documents->Open( $filename ) or die("Unable to open document ", Win32::OLE->LastError() +); print "Saving $filename "."as $savename\n"; $Word->ActiveDocument->SaveAs({ FileName => $savename, FileFormat => 8}); print "Closing document\n"; $Word->ActiveDocument->save( $filename ); $Word->ActiveDocument->save( $savename ); #$Word->Quit; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WIN32::OLE Word
by NetWallah (Canon) on Mar 14, 2008 at 16:00 UTC | |
|
Re: WIN32::OLE Word
by Erez (Priest) on Mar 14, 2008 at 14:42 UTC | |
by fox8267 (Initiate) on Mar 14, 2008 at 20:27 UTC |