in reply to "type mismatch" in Word

I ran your code, without the macro, and with the hashref, and it saved correctly as a Word binary document. I also fixed the line $xfn .= "\.doc"

use Win32::OLE; use Win32::OLE::Const 'Microsoft Word';; my $xfile = "C:/Documents and Settings/jim/My Documents/perlmonks_exam +ples/temp.txt"; $word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application'); $mydoc = $word->Documents->Open($xfile); #$word->Run("tskedfmt"); ($xfn) = $xfile =~ m/(.*)\.txt$/; $xfn .= ".doc"; $mydoc->SaveAs( {FileName => "$xfn", FileFormat => wdFormatDocument} ) +; $word->{Visible} = 1;
- j