Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
deleting info within a cell | Excel Discussion (Misc queries) | |||
Deleting Rows With Non-Needed Data between Needed Data | Excel Worksheet Functions | |||
Deleting info from all cells at once | Excel Worksheet Functions | |||
Hyperlink info & help needed | Excel Discussion (Misc queries) | |||
Info needed...please help! | Excel Discussion (Misc queries) |