How to use Close Workbook?

Hi,

Someone please help How to use Close Workbook?

I am opening excel using Excel Application Scope and assigning some variable in Output and while using Close Workbook activity I am giving the same variable name in Target property. But still I am getting an error. Also I am using the close workbook activity within the scope of Excel Application Scope activity.

Hi @cthamizh,
The problem is exactly this, you can’t use the Close Workbook activity right inside the Excel Application Scope .

4 Likes

Hi @acaciomelo, Yeah, It’s working :slight_smile:

1 Like

I am exactly using the same though I am getting error that particular value cannot be converted into UiPath.Excel.WorkbookApplication.

Close Workbook activity: how to properly use it

I understand this issue has already been sort of mentioned/addressed however I am wondering how to relate to this compiling error: "Value of type ‘UiPath.Core.Window’ cannot be converted to ‘UiPath.Excel.WorkbookApplication’

the first type is the variable defined for the attached window when using Excel Application scope

I have used the same variable in the ‘Close workbook activity’ outside the scope, and thats when i get the compiling error.

So what am I missing

@William_Adomako,

Just hit Ctl+k in the Excel Application scope output property and name the variable.

Just change the scope of the variable to global(parent container) from the variable pane.

image

sorry I used a start process activity to open the file not an excel application scope, my apologies for the mix up.
after the start process activity then i used an attach window to house all the activities which is ok.

it is the output variable of the attached window
that I am trying to use as target for the close workbook activity.

I don’t get it why you wanna do it with attach window and then coming back to workbook activity :stuck_out_tongue: there is a mismatch of variable.
However if you want to use attach window then use “Close window” activity which do accept “UiPath.Core.Window” as windows variable .
Close workbook works if your opening file in Excel Application scope activity

thnx for ur feedback, I appreciate it, I do understand the mismatch as you have mentioned. I will follow ur advise as stated

1 Like