cplau
asked on
Word Document Printing Issue
I am trying to print a Word 2003 document in my program by using an Interop object downaloded from Microsoft. (Interop.Word.dll). Below lists part of my code.
Public ObjWordBasic As Object
Public WordApp As Word.Application
My_Word.WordApp = CreateObject("word.applica tion")
My_Word.WordApp.Documents. Open(WordF ilePath & WordFileName)
My_Word.ObjWordBasic = CreateObject("Word.Basic")
If My_Word.ObjWordBasic IsNot Nothing Then
My_Word.ObjWordBasic.filep rint(0)
End If
.........
If My_Word.ObjWordBasic IsNot Nothing Then
My_Word.ObjWordBasic.filee xit(2)
My_Word = Nothing
End If
Somehow, oscasionally, I found that there is a WinWord.exe process left when checking the WIndows Task Manager after the printing. This causes the printing of another document failed.
I need to manually kill the WinWord.exe process left to resume the printing.
Please advise how I can rectify this problem. Thanks.
Public ObjWordBasic As Object
Public WordApp As Word.Application
My_Word.WordApp = CreateObject("word.applica
My_Word.WordApp.Documents.
My_Word.ObjWordBasic = CreateObject("Word.Basic")
If My_Word.ObjWordBasic IsNot Nothing Then
My_Word.ObjWordBasic.filep
End If
.........
If My_Word.ObjWordBasic IsNot Nothing Then
My_Word.ObjWordBasic.filee
My_Word = Nothing
End If
Somehow, oscasionally, I found that there is a WinWord.exe process left when checking the WIndows Task Manager after the printing. This causes the printing of another document failed.
I need to manually kill the WinWord.exe process left to resume the printing.
Please advise how I can rectify this problem. Thanks.
Use Marshal.FinalReleaseComObj ect(comobj ect)
Why are you using com when vb.net has intrinsic word automation
see here : http://www.codeproject.com /KB/office /WordPrint .aspx
see here : http://www.codeproject.com
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Hawkvalley1,
Thanks. I will test your suggestion later.
Thanks. I will test your suggestion later.