bodomalo@gmx.net Guest
|
Posted: Tue Sep 06, 2005 9:27 am Post subject: Delphi and MS Word |
|
|
Hello
I have a delphi programm which fill's out some Word Documents and
print's them.
I use the TWordApplication and TWordDocument Objects like
the following way:
msword.connect;
msword.visible := False;
msword.Documents.OpenOld(file, EmptyParam, readonly, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam);
doc.ConnectTo(msword.ActiveDocument);
.... Write something
doc.PrintOut;
doc.close(savechanges,Emptyparam,Emptyparam);
msword.Disconnect;
I have the following problems.
1) When Word has already been started before and a Document is opened,
then after that this Document is not accessible anymore. I have a plain
Word application with no Documents - BUT I can see this old Document in
the 'Window' menu of Word, it is greyed-out (not active/clickable).
When I exit Word it ask's me if I want to save this document.
Why Is it not possible to 'activate' it anymore?
2) When Word was not started before, then after the nsword.Disconnect
it is still active. It wont exit. Why? Even when I finish the
application Word is still active.
How can I solve these problems? What is the best solution?
Should I quit Word when starting?
Thanks
Bodo Malo
|
|