Overwrite existing Excel file

I have a web page that creates an Excel file that has today's date embedded in the name. If I run the code more than once per day I receive an error that the file already exists. Is there a way to simply tell aspose.cells to overwrite an existing file?

Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

path &= "d:\files\UpdateReviewDate-"

path &= Date.Today.ToShortDateString.Replace("/", "") & ".xls"

sheet.Cells.ImportFromDataReader(dr, True, 0, 0, False)

sheet.AutoFitColumns()

workbook.Save(path, FileFormatType.Excel2000)

Hi,

Thanks for considering Aspose.

No, I don't find the problem you are mentioning. I tried your code in a sample web application and execute the code several times without any problem or error message. And for your info, When you call Aspose.Cells.Workbook.Save() method, it will automatically overwrite the existing file.

Which version of Aspose.Cells you are using? Kindly use the latest 4.3.

Thank you.

I upgraded to version 4.3. Below is the error that I am receiving. The file is not being released. I even tried to delete the file from Windows Explorer but it tells me the file is in use.

The process cannot access the file 'd:\files\UpdateCLASReviewDate-7232007.xls' because it is being used by another process.

Hi,

Well, it might be an security issue, Please make sure that you got enough rights (Administrator comparable rights) to read / right files to the target folder. And also make sure that the files is not opened by you or any other user on the network in MS Excel or so.

I think you may also try to create an simple file on the folder without using Aspose.Cells to check your rights on the machine.

And you may also try testing your code in a winform solution that if the file is created fine or not.

Thank you.