Hi
I am working with Perl Version 5.8.8. I develop programs for a very big company so that I am forced to use this version. I am confronted with a serious problem and I hope that somebody of you can help me. Thanks so far.
I am using Tcl-Tk and Word. I try to insert OLE-Objects in Word while Tcl-TK-Widgets are open. But the Program gets stuck.The same effect occurs when I call the Windows-Message-Box ($mw->messageBox) before I try to insert OLE-Objects. I've wrote a very short code-example to demonstrate the effect. The only thing you have to do is to create a test.dat - File in c:\tmp with any content. (Or you modify the code accordingly)
When you press the first button, the widget will be closed and all runs well. But when you restart the program and press the second button, the program get stuck.
For every hint I would be deeply grateful.
Here the code:
#!/usr/bin/perl -w
use Tk;
use Win32::OLE;
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 $!;
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";
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.