I have various modules which open several workbooks (one by one), make
changes, then save & close them. Whenever I run a module in which
sheets are deleted via...
Application.DisplayAlerts = False
Worksheets(strMySheet).Delete
Application.DisplayAlerts = True
the file becomes corrupt. It saves and closes ok, but when trying to
open the file later, Excel crashes, giving the message:
Excel has caused an error in EXCEL.EXE. Excel will now close.
I've tried code cleaner, and even pasting the code into notepad, then
back into a new module, but neither has worked. I'm having to open the
files using OpenOffice, then saving in a different format then
re-opening with Excel. But I'm working with over a few hundred files
so I don't really have time to do this.
I'm not positive it's the sheet deletion that does it, but I've pretty
much narrowed it down to that because it's common among all the problem
mods and absent from all the others. Has anyone ever had trouble with
deleting sheets / file corruption? Anyone have any suggestions?
Thanks.
Bookmarks