Pass either a workbook variable OR the path to a workbook as arguments in separate workflows

For the first question, about the situation whether the workbook is already opened: simply use the ‘Excel application scope’. If the workbook is not opened, UiPath will open it and execute the activities in that scope. If the workbook was already open, then it will execute the activities. In both cases you can then use the output workbook variable of that ‘Excel application scope’ activity for your next activities.

For the password protected workbooks: you can use the ‘Invoke VBA’ activity to check whether a workbook has a password. Here you go:

Function Main() as Boolean

Main = ActiveWorkbook.HasPassword

End Function

You can now use the output variable, which is a boolean, for a if activity. In case the workbook was password protected (true), you can make a workflow to insert the password etc.

1 Like