Removal of modules
I can remove lines in CodeModule by using the following syntax
For I = 1 To 3
Application.VBE.SelectedVBComponent.CodeModule .DeleteLines (1), 1
But actually I would like to remove the whole module, does anyone know how to do this, if posssible ?
I found the solution. If anyone else is interested.
set a reference to:
Microsoft Visual Basic for Application Extensibility.
And use the following code in a module.
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("Module2")