I have an grid application that allows users to export the grid to Excel and display it. The application gives the Excel file a name that is related to the grid. If the user makes some changes and does a second export while the file from the first export is still open, it causes a System.IO.IOException, which says, "The process cannot access the file 'xyz.xls' because it is being used by another process."
Right now the user gets a message to close the original file and to try exporting again. There is no simple way to close the file from my application that I know of. I am thinking about changing the application so that the file has a unique name (using a guid or something) every time it is exported so that the exception does not occur. However, that would mean the user would possibly have multiple files open.
Which is worse--making the user close a file before they can export a second time or having multiple similar files open?
Update
Exporting to Excel is an option. Some users never export. Some users may export 10 or more times in one session. Users typically export to manipulate data in Excel or to format the data how they want it and then print.