cancel
Showing results for 
Search instead for 
Did you mean: 

IRPA could not find excel instance

liskaj01
Participant
0 Kudos

Hi, I have a scenario where IRPA downloads excel files from SE16N. As they are being opened automatically, I need to close them right after that. I created the scenario as below:

I put wait to 3 seconds as sometimes the run was too quick and continued without closing the excel.

This job runs during the night, where it always ends on error below:

During the testing and everytime I run the job manually it never fails so I am not able to simulate the issue. Any idea what may be wrong?

Thank you

View Entire Topic
lucie16
Active Participant
0 Kudos

In past someone give me advice to use Custom script. I use it since and it works. This custom script close all opened excels:

function formatEscapCaracters(f) { return f.toString(). replace(/^[^\/]+\/\*!?/, ''). replace(/\*\/[^\/]+$/, '');}
irpa_core.core.log('custom script close any opened Excel', irpa_core.enums.logType.Info, 'excelAutomation');
try { var MSScrCtrl = irpa_core.activeX.create("MSScriptControl.ScriptControl"); MSScrCtrl.AllowUI = 1; MSScrCtrl.Language = 'VBScript';
var VBScode = formatEscapCaracters(function () {/*! Sub closeAnyOpenedExcel() For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = 'EXCEL.EXE'") Process.Terminate Next End Sub */});
MSScrCtrl.AddCode(VBScode); MSScrCtrl.Run("closeAnyOpenedExcel");
irpa_core.core.log('custom script close any opened Excel', irpa_core.enums.logType.Info, 'excelAutomation');
} catch (error) {
irpa_core.core.log('closeAnyOpenedExcel Exception occured:' + error, irpa_core.enums.logType.Error, 'excelAutomation');
}


liskaj01
Participant
0 Kudos

Hi Lucie, as there has been some updates in Desktop Agent and SDKs in the meantime, I am not getting this error anymore. Currently I am always using Get Excel Instance, Close Excel Instance and Release Excel Instance for this activity.