LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default deleting worksheets corrupts files

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.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting Files Ben Dover New Users to Excel 2 August 4th 07 04:03 PM
File corrupts when saving under a different name - xl2000 Clayman Excel Discussion (Misc queries) 8 June 18th 07 07:19 PM
Reference to DLL corrupts on recompile of dll Robin Hammond[_2_] Excel Programming 2 April 12th 04 08:49 AM
Deleting files Tony C[_2_] Excel Programming 1 February 17th 04 12:27 PM
Deleting Files From VBA Brett[_4_] Excel Programming 3 November 21st 03 11:10 PM


All times are GMT +1. The time now is 08:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"