Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an Excel 2003 template that includes 2 macros, the final bit of code
removes both macros, as shown below -------------------------------------------------------------------------------- On Error Resume Next Set vbCom = Application.VBE.ActiveVBProject.VBComponents vbCom.Remove VBComponent:= _ vbCom.Item("Module3") vbCom.Remove VBComponent:= _ vbCom.Item("Module4") On Error Goto 0 End Sub -------------------------------------------------------------------------------- Users often have multiple files created from the same template open at the same time, unsaved. When the macro runs it sometimes removes the modules from the wrong file rather than the active one. What code do I need to add to ensure that the modules are deleted from the active file only? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can i stop people from deleting my excel file | Excel Discussion (Misc queries) | |||
How to stop file open macro prompt after deleting all macros? | Excel Worksheet Functions | |||
Deleting blank modules | Excel Discussion (Misc queries) | |||
Deleting modules in XLA | Excel Programming | |||
No success deleting modules | Excel Programming |