Actually you have make that object visible. Please find below the code :
#!/usr/bin/perl -w use Tk; use Win32::OLE; use Win32::OLE::Const; my $mw = MainWindow->new; $mw->Button(-text => "Run (Closed Widget)", -command => sub { $mw->destroy() })->pack; $mw->Button(-text => "Run (Opened Widget)", -command => sub { oleTest() })->pack; MainLoop; oleTest(); sub oleTest { my $word = CreateObject Win32::OLE 'Word.Application' or die $!; $word->{'Visible'} = 1; my $document = $word->Documents->Add(); print "Before OLE\n"; $document->InlineShapes->AddOLEObject("EMBED",'C:\tmp\test.dat'); +# this can be ANY test.dat print "After OLE\n"; $document->SaveAs('c:\tmp\test.docx'); $document->activewindow->{'Visible'}="True"; }
In reply to Re^2: TK and Word do not work together
by priyaviswam
in thread TK and Word do not work together
by Bauldric
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |