Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Module still there even after remove and save
I'm running some code in a module and then removing the module using
ThisWorkBook.VBProject.VBComponents.Remove etc. I then save the file using ThisWorkBook.Save. However, if I dont save the file on closing when prompted by excel then when I reopen the file the module is still there!! What am I doing wrong?? (The module is removed if I save at the excel prompt.) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Module still there even after remove and save
This worked for me
' in Module2 Sub test() Dim oComp As Object Set oComp = ThisWorkbook.VBProject.VBComponents("Module2") ThisWorkbook.VBProject.VBComponents.Remove oComp [a1] = ThisWorkbook.VBProject.VBComponents.Count ' 6 ThisWorkbook.Save Application.OnTime Now, "saveme" End Sub 'in Module1 Sub saveme() [a2] = ThisWorkbook.VBProject.VBComponents.Count ' 5 ThisWorkbook.Save End Sub The point being the module is only removed after all code in it terminates Regards, Peter T "shurstgbr" wrote in message oups.com... I'm running some code in a module and then removing the module using ThisWorkBook.VBProject.VBComponents.Remove etc. I then save the file using ThisWorkBook.Save. However, if I dont save the file on closing when prompted by excel then when I reopen the file the module is still there!! What am I doing wrong?? (The module is removed if I save at the excel prompt.) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Remove Module not working | Excel Programming | |||
Remove the module | Excel Programming | |||
Remove and Import Module | Excel Programming | |||
Remove VBA Project module | Excel Programming | |||
Remove VB Module from workbook | Excel Programming |