Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default More info needed on deleting macros on save

I have a sheet where I have added incremental numbering, some buttons
and user instructions. Once the user finishes and clicks a save
button, the sheet is automatically named and saved. I can see times
when a saved sheet will need to be opened and edited. Since the
macros are saved with the newly saved sheet, when it is reopened it
tries to increment the number again and prompts user with instructions
as if it was a new form. How can I get rid of all macros on the saved
sheet?

I've regularly seen the following routine recommended as a method to
accomplish this but it has failed to remove Module1 in my testing (the
routine does run successfully):

Sub save_wo_macro()

ThisWorkbook.SaveAs "newfile.xls"
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("Module1")
ThisWorkbook.VBProject.VBComponents.Remove VBComp
ThisWorkbook.Close SaveChanges:=True

End Sub

Can anyone give me some help and how to get this to work or an
alternate method to get rid of the macros in the saved sheet?

BrianG

PS: My programming experience goes back to some courses I took in
college 20+ years ago (Basic, Cobal, Fortran & Assembler). I can
handle programming logic but this Methods, Objects, Properties thing
is a struggle for me.
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
deleting info within a cell jkc Excel Discussion (Misc queries) 2 February 9th 10 04:18 PM
Deleting Rows With Non-Needed Data between Needed Data Daren Excel Worksheet Functions 2 September 30th 08 06:47 PM
Deleting info from all cells at once days_crazed Excel Worksheet Functions 2 April 17th 06 03:40 PM
Hyperlink info & help needed John87111 Excel Discussion (Misc queries) 0 April 26th 05 08:58 PM
Info needed...please help! joe smith Excel Discussion (Misc queries) 1 March 22nd 05 02:43 PM


All times are GMT +1. The time now is 05:24 AM.

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

About Us

"It's about Microsoft Excel"