Hi - can anyone help?
On opening a Windows Application Form I need to identify if WINWORD.EXE is running before I action any code. Is there a way to check if the application is open?
Thanks
Jack
Identifying if WINWORD.EXE is running (Office 2010)
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
-
- Administrator
- Posts: 7210
- Joined: 15 Jan 2010, 22:52
- Location: Middle of England
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Identifying if WINWORD.EXE is running (Office 2010)
Thanks Leif .... works like a charm.
I stand corrected - it's not exactly what I'm after. The issue I have is that certain documents are causing Word 2010 to hang, the user will then close Word but WINWORD.EXE stays open in the taskpane. I need to identify if WINWORD.EXE is open before ending the process so I can run the necessary code to repair the document that is causing Word 2010 to hang.
Any ideas?
Cheers
Jack
I stand corrected - it's not exactly what I'm after. The issue I have is that certain documents are causing Word 2010 to hang, the user will then close Word but WINWORD.EXE stays open in the taskpane. I need to identify if WINWORD.EXE is open before ending the process so I can run the necessary code to repair the document that is causing Word 2010 to hang.
Any ideas?
Cheers
Jack
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Identifying if WINWORD.EXE is running (Office 2010)
This works guys .... just in case anyone needs it in the future:
Dim strComputer As String = "."
Dim strProcessKill As String = "'winword.exe'"
Dim objWMIService As Object = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Dim colProcess As Object = objWMIService.ExecQuery("Select * from Win32_Process Where Name = " & strProcessKill)
For Each objProcess As Object In colProcess
objProcess.Terminate()
Next
Dim strComputer As String = "."
Dim strProcessKill As String = "'winword.exe'"
Dim objWMIService As Object = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Dim colProcess As Object = objWMIService.ExecQuery("Select * from Win32_Process Where Name = " & strProcessKill)
For Each objProcess As Object In colProcess
objProcess.Terminate()
Next
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Identifying if WINWORD.EXE is running (Office 2010)
Thanks for sharing the solution!
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 5411
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Identifying if WINWORD.EXE is running (Office 2010)
It's a one-line BATch file, if anyone is interested!
John Gray
"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...
"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...