Creating a bot to open a excel file and using save as activity. Facing “Save Excel File As: Object reference not set to an instance of an object.” error. Could you guys help on this ?
Getting an Error "Save Excel File As: Object reference not set to an instance of an object."
Welcome to community.
Have you had a chance to review this issue?
For better understanding can you share the screenshot of the flow.
@muhammedyuzuak Apologies, i’m not clear with that. I’m trying to save as the file which was opened already. Here i’ve declared variable also
@Sanjit_Pal Please find the attached flow screenshots.
Why you have invoked 2 Use Excel File activity and also why you are passing the path of excel.exe .
Once you have invoked the Use Excel File activity and passed the filepath into that activity the excel instance will get initiated not need to initiate the another instance by passing the executable excel path. As I think due to the multiple instances that error is occurring.
Do it like this, it won’t throw any error.
@Sanjit_Pal Correct, Here i have to use dynamic file. Lets say every time the bot have to export a excel file from portal then have to open it and need to find out if anything there for todays date and if yes then have to save as the file as “Output.xlsx”
If i choose excel for output.xlsx then the use excel activity will work on that file only right.
Here i have to use already downloaded file/using file.
Instead of that “Output.xlsx” you can keep it dynamic, just make sure to create the dynamic selector for the click activities and at the end after the required things get done you ca use the Save As File activity to save that file with someother file name.
Or if you want to do in other way, we have the other solution as well.
- Use copy file activity to copy the input file
- From second step whatever you were performing in the input file now you can perform in the copied file, in this way you need not to do the save as.
Just make sure Save Changes Property should be checked.