"Microsoft.Office.Interop.Excel" Assembly Import Failes

Hi Friends,

I have a strange issue.

I am using invoke code to perform few operations on excel in uipath.

When i import “Microsoft.Office.Interop.Excel” Assembly the code did not recognize it.
So, i closed UiPath Studio, opened main xaml in notepad and added the below namespace
xmlns:moie=“clr-namespace:Microsoft.Office.Interop.Excel;assembly=Microsoft.Office.Interop.Excel”

and reopened my main xaml. it worked like a pro.

The problems comes here, When i close UiPath studio and open the same xaml the next day or the same day, the namespace got lost somewhere.

Should i add namespace everytime this way? If so, i cant proceed with this . Please help me in finding a permanent solution.

Thanks,
Devi

Hi, Devi!

Check my tutorial for using Office Interop here:

1 Like

Thanks @oddrationale it worked … :slight_smile:

Another quick question.

How to read (.msg) files from folder and save the attachments? I have used the below vbs code to read the mail message from folder and save the attachment.

Dim OlApp
Dim Eml

Set OlApp = CreateObject(“Outlook.Application”)
Set Eml = OlApp.CreateItemFromTemplate(“C:\Users*******.msg”)
Download(Eml)

Sub Download(objEml)
For Each Attch In objEml.Attachments
Attch.SaveAsFile "C:\Users******\readMailMsg" & Attch.FileName
Next
End Sub

It works when i hard code the mailmsg path. But throws permission error like below.

image

Could you help me where i am wrong here??

Thanks,
Devi

Are you using the Invoke Code activity or the Invoke VBA activity within the Excel Application Scope?

I am not using any of it. The code is in a separate vbs file and running the vbs file using “Start Process” activity.

image

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.