Thread: Remove Modules
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Remove Modules

You must have the Visual Basic for Applications Extensibility Libray referenced
under ToolsReferences.

Chip points this out at the site you were guided to.


Gord Dibben MS Excel MVP


On Tue, 25 Sep 2007 05:54:00 -0700, Pedro Serra
wrote:

I'm trying to put the following code avalaible in the link u send me, but I
keep getting a compile error user-defined type not defined!

Sub DeleteModule()
Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent

Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents("Module1")
VBProj.VBComponents.Remove VBComp
End Sub

Can u help me?

Thanks,

"RB Smissaert" wrote:

All explained nicely he
http://www.cpearson.com/excel/vbe.aspx

RBS


"Pedro Serra" wrote in message
...
Is it possible to build a code to remove excel vb module 1, module 2 and
module 3 that I have in my VBA project?

For instance I'm trying to remove module 1 after I execute the macro, I
then
execute the macro in module 2 and remove module 2 ...

Thanks,