![]() |
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. |
All times are GMT +1. The time now is 07:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com