Invoke code activity creates an issue

Hi All,

I am trying to close Active excel file using invoke code activity but getting below error.

Method not found: ‘Microsoft.CodeAnalysis.SyntaxTree Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxTree.ParseText(System.String, Microsoft.CodeAnalysis.VisualBasic.VisualBasicParseOptions, System.String, System.Text.Encoding, System.Collections.Immutable.ImmutableDictionary`2<System.String,Microsoft.CodeAnalysis.ReportDiagnostic>, System.Threading.CancellationToken)’.

Hi @rushabhshah1411

Have you inported Microsoft.Office.Interop.Excel
Namespace in import panel

Yes, I did tried that as well.

can you share your code

Hello Robinnavinraj,

I cannot share the code because it is on client machine and it restricts any sharing of code or document outside the environment.

Can we have another solution for this?

method not found issue occurs when you haven’t installed namespaces
find the method which is throwing error and install the correlated namespace

What Invoke code piece of code does is, it has 2 lines of code which basically checks for rows with space and trims them… using datatable concept.

Namespace is imported for the whole solution.

Dependencies added are:
UiPath.Excel.Activities = 2.11.4
UiPath.Mail.Activities = 1.12.3
UiPath.System.Activities = 21.10.3
UiPath.UIAutomation.Activities = 21.10.4

Hi @rushabhshah1411

no you have to import namespace in import panel
look at the below image for more reference


Yes, I have the exact same thing at my end. I did imported it long time back when I faced the same issue. Now this issue has arise again.