Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

nihhalmca
Valued Contributor II

How To Kill "Excel.exe" Process by Macro

Hi All,

I want to kill "EXCEL.EXE" Process by Macro.

Could you pelase share VB Script (.VBS).

Thanks,

Nihhal.

1 Solution

Accepted Solutions
Frank_Hartmann
Honored Contributor II

Re: How To Kill "Excel.exe" Process by Macro

I think this should terminate the EXCEL.EXE:

Sub TerminateProcess

Dim Process

For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = 'EXCEL.EXE'")

   Process.Terminate

Next

End Sub

hope this helps!

View solution in original post

3 Replies
MVP & Luminary
MVP & Luminary

Re: How To Kill "Excel.exe" Process by Macro

If possible try to terminate this process before (after excel finished the task to which it was created). If you really need to go further with this approach take a look here: Re: How to create kill QV task which you could adapt from qlik to excel.

- Marcus

Frank_Hartmann
Honored Contributor II

Re: How To Kill "Excel.exe" Process by Macro

I think this should terminate the EXCEL.EXE:

Sub TerminateProcess

Dim Process

For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = 'EXCEL.EXE'")

   Process.Terminate

Next

End Sub

hope this helps!

View solution in original post

Highlighted
nihhalmca
Valued Contributor II

Re: How To Kill "Excel.exe" Process by Macro

Thank you.

'1) User Define Function in VBS

Sub TerminateProcess 

Dim Process 

For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = 'EXCEL.EXE'") 

Process.Terminate 

Next 

End Sub

'2) Call when yoiu required for end process

TerminateProcess

Note : it will lost all un saved data