PDA

View Full Version : Saving after autodeleting



makako
03-21-2007, 04:52 PM
Hi, I have a program that i would like to auto-destruct after a specific period of time.


With ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
.DeleteLines 1, .CountOfLines
End With
With ThisWorkbook.VBProject.VBComponents("UserForm").CodeModule
.DeleteLines 1, .CountOfLines
End With
Application.Workbooks("MyMacro").Save


After running it the code is deleted but the workbook does not autosave, thanks

lucas
03-21-2007, 08:32 PM
try something like this:
ActiveWorkbook.Save

makako
03-22-2007, 05:43 AM
sorry, i forgot to say im working through an addin. by saying activeworkbook.save the current workbook will be saved instead of the addin

lucas
03-22-2007, 05:57 AM
so you want to delete code from the addin???

makako
03-22-2007, 04:17 PM
yes