Link to home
Start Free TrialLog in
Avatar of smaram1
smaram1

asked on

WINWORD.EXE not closing after mWordObject.ActiveDocument.PrintOut()

I have a requirement where i need to print set of documents and this is working fine. But all the WINWORD.EXE's for each document are staying in Task Manager and i have to manually end all the processes.

Please let me know how to overcome this. If i do this

                mWordObject.Application.Quit()
                mWordObject = Nothing

It closes the WINWORD.EXE but it closes even before it prints. I want to know if there is a method which can find when the printing is done and then closes the WINDWORD.EXE files.

Any help/suggestions would be really helpful.

Thanks
Sureshj
Avatar of smaram1
smaram1

ASKER

Actually this doesnt work too...

                mWordObject.Application.Quit()
                mWordObject = Nothing
Hi smaram1,

Try the following:

mWordObject.ActiveDocument.PrintOut()
Do While objWord.BackgroundPrintingStatus > 0
Loop

mWordObject.Application.Quit()
mWordObject = Nothing

Let me know if that doesn't work.

Cheers!
ASKER CERTIFIED SOLUTION
Avatar of Hillwaaa
Hillwaaa
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial