in reply to Re: TK and Word do not work together
in thread TK and Word do not work together
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: TK and Word do not work together
by Bauldric (Novice) on Nov 16, 2011 at 14:54 UTC |