Skip to main content

We are using a VBScript in Automation Anywhere 360 and using VbScript to attach multiple files into a Microsoft Word document. The script runs fine for a certain number of transactions, successfully attaching files and closing Word properly. However, after reaching a certain number of executions, Word fails to close properly.

 

Observations:
1. Word appears to close from the front end, but when checking Task Manager, WINWORD.EXE is still running in the background.
2. The attachments are saving properly, so the issue seems to occur after the file attachments, during the closing process.
3. The script freezes after multiple runs, likely because Word is stuck in the background.
4. The issue does not happen immediately, but after several executions.

Hi ​@KushalVadgama,

have you tried this one?

 

Cheers

Marc

 

 


Hi ​@Marc 1985

Yes, we kill all the unwanted session once the transaction is completed or at start of the transaction 


@KushalVadgama and you can not include this in an error trap to be triggert if needed?


@KushalVadgama 

Something like this in VB Script:

Function KillAll(ProcessName)
Dim objWMIService, colProcess
Dim strComputer, strList, p
Dim i :i= 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name like '" & ProcessName & "'")
For Each p in colProcess
p.Terminate
i = i+1
Next

End Function

call KillAll("WINWORD.exe")

 


Thanks ​@Marc 1985 


@KushalVadgama let us know if it worked for you please… 😊


Reply