In my workflow im using Write Range to update table in Excel. Then i try to save changes by using Close Workbook activity with the parameters:
Save Changes: True
FIlename: [the same variable that used in the Write Range].
Workbook: empty.
But instead of automatically saving and closing Excel file, Excel application provide pop up windows with the question: “A file named * already exists in the location. Do you want to replace it?”
Set a variable for the workbooksession from your writerange, and pass that to the CloseWorkbook activity (no filename needed). It will then use the same excel “session” to the file.
At least that’s what works for me.
yes.
the scenario with session variable also worked for me. but when i reuse the same variable for editing next file: in the Write Range and Close Workbook activities, i have got an error # The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)). in total i have to update 6 files in one workflow.
maybe there is some working scenario without creation 6 different session variables - one for each file?
and path variable for the files already present in the workflow, that is why im interested in reusing them.
Try setting it to null (Nothing) between the files.
The excel activities check if the session object has something, and if it does, they try to connect to that session.
That said, be careful with reusing variables, it can get confusing. So even if sometimes having multiple variables can luck meh at first, it avoids value leakage between different things.
Also, you may want to look into variable scopes, which is a way of limiting the variable lifetime within a workflow.