Vb code to close word with out saving

Hi
I need vbscript to close all active word without savings. Reason being in office 365 if the word application is killed, then all the previous instances will be opened when we try to open any word.
So I need to close all existing instances with out saving before i start processing the cases.

Hey @Rilna_Rilna

Welcome back to the forums, please try this vbscript:

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")

Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'WINWORD.EXE'")

For Each objProcess in colProcesses
    objProcess.Terminate()
Next

Please note that this script forcefully terminates Word processes, which may result in unsaved data loss. Use it with caution. Hope it helps.

1 Like

You can use KILL PROCESS activity with ProceasName as ”WINWORD”
Which will close all word application abruptly

Cheers @Rilna_Rilna

1 Like