A macro enabled Excel file has recently started to crash with error message 'Microsoft Excel has encountered an problem and needs to close' while running
ActiveWorkbook.SaveAs Filename:="C:\Excel\Filename.xls".
The file was orginally created using Excel 2003 and has worked fine for over two years. The main user of this file upgraded to Excel 2007 about a year ago but the error didn't appear until a few weeks ago.
I have tried changing the code by declaring string variables for the filename and the path then using the following code to save the file.
Workbooks(filenameVariable).SaveAs Filename:=pathVariable & filenameVariable
I have also tried repairing the Office installation, reinstalling Office, changing the destination folder and running chkdsk. The macro still works on Excel 2003. I didn't get a chance to try it on another PC with Excel 2007 but I assume that it would work.
Bookmarks