use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; use Data::Dumper; # Update: The following line, per advice below, solves my problem: # $Data::Dumper::Maxdepth=2; # check if Word exists my $x = Win32::OLE->GetActiveObject('Word.Application'); die "Word not Installed" if $@; warn "1 OK to here.\n"; # start Word program, die if unable to unless (defined $x) { unless ( $x = Win32::OLE->new('Word.Application', sub { $_[0]->Quit; }) ) { die "Cannot start Word.\n"; } } warn "2 OK to here.\n"; do_dumper( 'wobjX:', $x ) if 1; warn "3 OK to here.\n"; my $template_file = 'e:\\aa\\myfile.dot'; my $d; unless ( $d = $x->Documents->Add( $template_file ) ) { die "Cannot open file '$template_file': $!\n"; } do_dumper( 'wobjD:', $d ) if 0; undef $x; undef $d; warn "4 OK to here.\n"; sub do_dumper { my ( $label, $variable ) = @_; my $msg = Dumper( $variable ); open P2W, ">> p2w_out.txt"; print P2W "$label:\n$msg\n"; #warn "$label:\n$msg\n"; close P2W; }