|
-
Feb 27th, 2010, 12:29 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] URGENT - creating word object with office.interops
I am using the office interop to open word documents and saving as html to do parsing work. After a few executions I notice that in the task manager under processes there are still instances of WINWORD.EXE running. I have used the
following to close the object but it is still there:
Code:
wordApp.Quit()
wordApp = Nothing
How do I close this in order to avoid overhead? Any ideas appreciated
Last edited by cengineer; Feb 27th, 2010 at 01:08 PM.
Reason: urgent help needed
-
Feb 27th, 2010, 12:44 PM
#2
Re: creating word object with office.interops
I had similar probelm with Excel...
You can do like i did, something like when start the process get the process id, and when you want quit, after saving and done everything you need, just call the kill method of the process...
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Feb 27th, 2010, 12:49 PM
#3
Thread Starter
Hyperactive Member
Re: creating word object with office.interops
Thanks for the response; do you mean create a process when running the specific function or are you referring to the word.application.
Pardon my ignorance
-
Feb 27th, 2010, 03:02 PM
#4
Re: URGENT - creating word object with office.interops
I'm referring to the application...
Here what i do in excel:
VB.NET Code:
'Declare the function GetWindowThreadProcessID
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As IntPtr, ByRef lpdwProcessId As IntPtr) As IntPtr
...
prgExcel = New Excel.Application
Dim inProcess As IntPtr 'To save the pointer to the process
Dim inHandle As IntPtr = prgExcel.Hwnd 'Handle
GetWindowThreadProcessId(inHandle, inProcess)
Dim processExcel As Process = Process.GetProcessById(inProcess.ToInt64)
...
'To close the application, if you call the quit and the application still open, just call the kill method
processExcel .Kill()
Rate People That Helped You
Mark Thread Resolved When Resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|