Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to delete sheets and saves remaining file does not properly delete module


I have a macro that has the user save the file through a command butto
rather than the regular save. This macro checks for data entry errors
deletes sheets that were not selected for data entry, and saves th
remaining file.

However, the sheet module from the deleted sheets does not get delete
(when I say delete, I do not mean that I want the code in the module t
be blanked; I mean that the module should no longer appear in VBE jus
as the sheet does not appear in the Excel interface).

Simplified code:

Private Sub deleteandsave()
Sheet1.Delete
ThisWorkbook.Save
End Sub

If you look at VBE after running this, the sheet module for Sheet1 doe
indeed get deleted. However, the file that was actually saved maintain
the sheet module although the worksheet itself was deleted. This i
effect produces a file with a sheet module that is linked to th
"ether". This unlinked sheet module can have strange behavior on th
rest of the file even if blank.

Any suggestions that makes sure that the module gets deleted before th
save command is run? (I prefer that Save is not a separate action - I
you delete sheets and then Save as two independent actions - tw
buttons - the unlinked sheet module does not occur

--
pherreroPosted from http://www.pcreview.co.uk/ newsgroup acces

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to delete sheets and saves remaining file does not properly delete module


Your code works for me

Ga

--
gazornenpla

-----------------------------------------------------------------------
gazornenplat's Profile: http://www.excelforum.com/member.php...fo&userid=2449
View this thread: http://www.excelforum.com/showthread.php?threadid=38090

Reply
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
macro-delete all sheets except puiuluipui Excel Discussion (Misc queries) 6 October 13th 09 05:49 AM
code to delete module / macro in another file Ray Clark[_2_] Excel Discussion (Misc queries) 1 July 3rd 08 04:15 AM
Delete macro that is not in a module [email protected] Excel Discussion (Misc queries) 5 September 21st 07 06:15 PM
Macro to delete unwanted sheets Sal Excel Discussion (Misc queries) 5 March 15th 07 09:33 PM
have Macro automatically delete and create sheets web_surfer[_2_] Excel Programming 0 February 27th 04 04:03 AM


All times are GMT +1. The time now is 01:33 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"