I get an error when i execute 2 times a VB.NET code with Excel.Interop

I get this error:



When im closing Excel inside Invoke Code


¿How can i fix it?,

Kindly update the uipath.excel.activities under project dependencies in manage packages option in design tab of studio
restart the studio and try once

Cheers @inf_L

the error appears when i use excel activites in a loop. Microsoft says why we get this error:

Visual Basic has established a reference to Excel because of a line of code that calls an Excel object, method, or property without qualifying the element with an Excel object variable. Visual Basic does not release this reference until you end the program. This errant reference interferes with automation code when the code is run more than one time.

And say how to resolve it:

To resolve this problem, modify the code so each call to an Excel object, method, or property is qualified with the appropriate object variable.

But i dont know how to implement the solution in the end instances.