I am getting below error when my bot is running

Hey ,@PD2

Thanks for the reply.I too checked the above links ,but no luck :frowning:

FYI-Excel has 300000 Data(as huge).It has plain 2 dimensional data and we dont have any charts in the excel.We are trying to invoke the macro within the excel application scope.

Any workaround for this?

TIA

I haven’t tried this, since you mentioned Macros within Excel Application scope,it’s worth a shot:

1 Like

I realized this error appears in 2018.4.2, but when I run the same bot in 2018.4.1 everything runs fine.

Can someone from UiPath look into this?

It seems the error is popping up randomly in both 2018.4.1 and 2018.4.2.
Sometimes it works, sometimes it just throws the error.
This is really strange. If anyone could assist that would be helpful.

Hi @cclam81

Could you post a screenshot of the error message you are receiving and some context?
Also, do you use the Community Edition or the Enterprise Edition?

Would it be possible for you to create a new project with minimum amount of activities that would reproduce the error. A sort of a sample, dummy project for us to investigate?

Also, if you happen to be on the Enterprise edition, please create a Support ticket to properly track the issue.

Hi @loginerror, thanks for your reply.

I realized the issue I am facing should be on a separate thread since the process does not involve executing macro within an Excel application scope. However the exception encountered is quite similar. The process involves reading some data using Read Range into datatables from two Excel files. The exception occurs very randomly and if it happens, it’s always at the second Excel application scope.

UiPath%20InvalidCastException

Details:
18.4.2+Branch.master.Sha.9888b477be8d3ec8a832306fc59c34ba6edad108

Source: Excel application scope

Message: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘System.Runtime.InteropServices.ComTypes.IConnectionPointContainer’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{B196B284-BAB4-101A-B69C-00AA00341D07}’ failed due to the following error: The requested object does not exist. (Exception from HRESULT: 0x80010114).

Exception Type: System.InvalidCastException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘System.Runtime.InteropServices.ComTypes.IConnectionPointContainer’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{B196B284-BAB4-101A-B69C-00AA00341D07}’ failed due to the following error: The requested object does not exist. (Exception from HRESULT: 0x80010114).
at UiPath.Excel.WorkbookApplication…ctor(String workbookPath, String password, Boolean visible, Boolean autoSave, Boolean createNew, String editPassword, Boolean readOnly)
at UiPath.Excel.Activities.ExcelApplicationScope.Execute(NativeActivityContext context)
at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

I am using Community Edition.

Please find below the sample project. Note that the above error occurs very randomly. And if the above error doesn’t appear, there will be a Runtime execution error:

Runtime%20execution%20error

TestForError.zip (38.8 KB)

Update: Unfortunately, when I open the sample project attached now, no errors will occur. The error can only be reproduced if I run the original project, but I can’t attach the original file and original Excel files as they contain sensitive data.

Interesting. This is already a valuable information, as it proves that there must be something in particular that is causing this issue.

Ideally, the path to fix this issue is to keep adding things to the small sample files until it starts reproducing the issue.

Could you give us an overview of how the original project looks like?

A quick thought - could you maybe introduce a small delay between the two Excel scopes in your original project (if they happen to be right after each other)?

Just as a side note, I am getting EXACTLY the same error message listed earlier in this thread (the COM QueryInterface error), right down to the Windows registry ID and HRESULT code… I am not on 18.4 however, I am on 18.2.4.

All other behaviors identical. Sporadic issue, only happens with back-to-back Excel Application Scope activities. Since adding a 5 second delay between activities earlier today, I have not received the error.

I have since tried another solution: Adding a Do-While loop containing a Try-Catch containing the second Excel Application Scope. And I also tried a 5 second delay between two Excel Application Scope activities. Both solutions worked.

It seems the problem lies in Excel not having released from memory fast enough in the first Read Range activity before the second Read Range activity starts.

@loginerror Regarding your question about the original project, the Excel files are quite small in size (<300kb). Nothing special about the files.

I guess the solution is really to introduce a short delay between any two Read Range activities. Perhaps this has nothing to do with the Excel Application Scope activity but rather how fast the Excel file can be released from memory in the first activity before moving on to the next activity involving another Excel file.

4 Likes

@cclam81 is right. I too get this error, but when I added a delay of 2 or 3 seconds between the excel reads/write of same excel, error was gone.

HI guys

I am getting the same error as well
image

This happens at the second application scope
I did put a delay in between the excel applicaiton scopes and this has been working previously. But for some reason today, i am getting the following error.

If anyone has found another solution, please let me know

This problem continues to happen, UiPath needs to pay attention to this problem, macros are an important part in many process automations.

1 Like

Hi @armando.rueda

Could you explain your particular situation? I’ve seen this issue around and it seems to be related to some UiPath Excel activities (such as Copy Sheet) not working properly on the older versions of Excel (<2016). Is it the case for you?

If not, could you provide a sample project that causes the issue for you? Please include the version of your Studio, activity packages and your MS Office full version number (as seen in the backstage view).

Also, if you own the Enterprise edition, please also contact our technical support directly

1 Like

HI, Have you fixed this ?

HI, I can see this error when I use copy sheet. My Excel version is 2016MSO(16.0.4266.1001) x64(EN)
Excel version is 2016MSO(16.0.4266.1003) x64(Chinese)
Is there any update?
copy sheet: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.Office.Interop.Excel._Workbook’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208DA-0000-0000-C000-000000000046}’ failed due to the following error:The requested does not exist。 (Exception from HRESULT: 0x80010114).

Thanks,

Hi @Biddles

Welcome to our UiPath Forum1 :slight_smile:

Could you maybe attach a new, sample project that reproduces the issue for you?
(a full project with Main.xaml and project.json file where the error will happen after running the process)

We were also facing such issues where ever we had multiple Excel Scope activities. So had to add 3 to 5 second delays in between the excel scope activities.

1 Like

I can resolve this problem by disable add-in in Excel by follow below post.

2 Likes

I was also having this problem and removing the Excel .com add in resolved it for me.

I also had the same problem. Removing the COM add-ins works for me :slight_smile: