Check if WorkbookApplication variable is an open workbook

Hi, how do you get the boolean expression to check if the WorkbookApplication corresponds to an open Excel workbook? Thanks

Hi,

How about the following?

Regards,

1 Like

Hi, I was thinking that sometimes ReFramework closes or kills the process but the variable might still be not nothing. That’s why I’m asking. Would this method of checking for workbook Is Nothing still work?

Edit: I tested a sample workflow where I used Kill Process after Excel Application Scope, UiPath still treated the workbook as opened even after Kill Process. Please help, thanks

Hi,

I got your matter. I suppose perhaps you should use System.Diagnostics.Process instead of WorkbookApplication in this case.
If you could get process instance of Excel (Let’s say proc) using GetProcesses activity or Process.GetProcessesByName method etc, proc.HasExited will work.

FYI, If you want get process from window, GetProcessFromMainWindow activity in the following package might help you.

Regards,

Hi, is there any workaround for this? I absolutely must use WorkbookApplication in my workflow