T
Tamas Demjen
I need to batch print documents by automating Microsoft Word. All is
fine until document revisions are involved. PrintOut won't print the
revisions unless a large delay is added. I'm doing this from C++, but
the language is irrelevant here:
pDoc = pWordApp->Documents->Open(...)
pDoc->PutShowRevisions(VARIANT_TRUE);
pDoc->PutPrintRevisions(VARIANT_TRUE);
//<-- a 1 second wait is needed here
pDoc->PrintOut(...)
I noticed that when I open the document in Word 2007, it doesn't show
the revisions until a few seconds later. If I hit Ctrl+P (print)
instantly (before it shows up on the screen), the revisions don't print.
So I'm pretty certain the problem is with Word itself, and not with my
code. In comparison, Word 2003 shows the revisions almost instantly.
Needless to say, the amount of waiting needed is not predictable. It
depends on the performance of the computer, and on how busy it is at the
moment. Unless I put a really large delay, I can't be 100% sure that the
revisions will print.
Is there is a way to programmatically check whether Word is ready to
print the revisions? Something that I can query periodically using
automation to check when the revisions are ready to go? Or do I
absolutely have to rely on an inexact Sleep?
Thanks,
Tom
fine until document revisions are involved. PrintOut won't print the
revisions unless a large delay is added. I'm doing this from C++, but
the language is irrelevant here:
pDoc = pWordApp->Documents->Open(...)
pDoc->PutShowRevisions(VARIANT_TRUE);
pDoc->PutPrintRevisions(VARIANT_TRUE);
//<-- a 1 second wait is needed here
pDoc->PrintOut(...)
I noticed that when I open the document in Word 2007, it doesn't show
the revisions until a few seconds later. If I hit Ctrl+P (print)
instantly (before it shows up on the screen), the revisions don't print.
So I'm pretty certain the problem is with Word itself, and not with my
code. In comparison, Word 2003 shows the revisions almost instantly.
Needless to say, the amount of waiting needed is not predictable. It
depends on the performance of the computer, and on how busy it is at the
moment. Unless I put a really large delay, I can't be 100% sure that the
revisions will print.
Is there is a way to programmatically check whether Word is ready to
print the revisions? Something that I can query periodically using
automation to check when the revisions are ready to go? Or do I
absolutely have to rely on an inexact Sleep?
Thanks,
Tom