How to save workbook and close workbook within excel application scope?

When I run job, excel opens and copies values…but excel is not getting closed after saving.

What might be the issue ?

close%20workbook

1 Like

@johns

Create one workbook variable for Excel Application Scope Activity and pass that variable into Close Workbook Activity to close it.

Can you show practically by providing example or .xaml file to save it, and close the application.

It will be very helpful for me.

Keep the close workbook activity outside the excel application scope. Provide the path of excel in excel application scope and take the output to close workbook.

image

1 Like

Could you send me xaml file.

I have a big work-flow. Where can I use Excel application scope. I need to save workbook and close the workbook.

Can someone send me xaml file?

@johns

Please find the attached workflow for your reference.

Excel.xaml (6.4 KB)

Hi Lakhsman,

Thank u for sharing everytime something new.
I have question very similar to this:

I have to extract the data and save it in an excel file and then again in ht e next step I have to save it in a Text format as well but when it saves in the excel format, it saves but also opens up the file(excel). Now I want to close this file and then perform the 2nd step as mentioned above. So for this shall I use Kill process(to close the excel which is opened or close application or close workbook, but in that case I need to give the path of the file where it is saved.
Thank u in advance

1 Like

@lakshman: For me is not really clear why I have to use this close workbook activity. There is nothing written proper in the docs.
For me the application scope looks like a “using” in C#. So according my understand the application scope is also responsible to closing the excel proper.

According the sample https://docs.uipath.com/activities/docs/manage-multiple-excel-files this is only possible in the case you save workbook into a variable to pass it to another workflow. Like this the application scope does not cleanup because the is a reference to this workbook.

I found a some questions about it and there is no clear statement.

1 Like

@Stephu

Some times it will failed to close excel file right. That’s why we need to use Close Workbook activity to close the excel file.

Alternatively if you want to close file forcefully then use Kill Process activity and provide ProcessName as “excel” to close all opened excel files.

I do not like “some times it fails” in the case of stable bots. Really missing an official statement in docs from uipath.
Kill process “excel” is dangerous in the case this bot is running on a server where multiple bot are running. With this you kill all excel of all sessions which are active. We found this last week.

2 Likes