Excel Workbook Getting closed unexpectedly

Hi there,

I am working on Excel Application Scope as below (sample).

Initially I have created Workbook Application variable and using that in the Excel Application Scope inside For each loop activity to write into cells. But after writing into certain cells excel is getting closed although still there is something to write and getting the error as below:

image

Any thoughts on this, why it might be happening? Thanks in advance.

Hi! @Robotman,

Can we try with workbook activities! which don’t require the application scope.

Just type for read range in activities panel. You may see 2 read ranges activities.

take read range from workbook not from excel.

Excel read range requires excel application scope when it comes to workbook we don’t require application scope

Your workflow look like this

Regards,
NaNi

1 Like

Hi,

I think it’s better to get target sheet name in advance, as the following, because the exception seems to fails to get sheetname in WriteCell.

Regards,

1 Like

Hi @Yoichi,

I have tried in this way. It’s not working. I could see that the problem is with Excel Instance itself. After few iterations, it’s closing automatically and returning the not able to find the sheet.

Any further thoughts?

Hi,

If you can use the latest excel package, how about using ExcelProcessScope and UseExcelFile activity (ModernExcel)? I suppose its process control is better than ExcelApplicationScope.

Regards,

Thank you @Yoichi for the suggestion. But at the moment, I would require to do lot of changes to the code.

But still wondering, I didn’t closed or killed the excel but it is getting closed in between and creating the unnecessary issues.

@ppr @Palaniyappan