VB5 and Excel
Posted on 1999-01-22
I have created an excel object from VB. I write data to the spreadsheet object and before I close the app I would like to save the workbook. I am using the commondialog control to set the filename and path and then using workbook.saveas(commondialog.filename). The problem is if the filename I am using already exists in the path that I have selected then excel brings up the dialog that asks if you want to save over the existing file. If you answer NO then I get a runtime error 1004 "method saveas of object workbook failed".
Can anyone give me a solution or a way to check if the file exists before the workbook.saveas call?