ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Remove Modules (https://www.excelbanter.com/excel-programming/398081-remove-modules.html)

Pedro Serra

Remove Modules
 
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,

RB Smissaert

Remove Modules
 
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,



Pedro Serra

Remove Modules
 
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,




RB Smissaert

Remove Modules
 
Did you set the reference to the VBE Extensibility as explained in that
link?

RBS


"Pedro Serra" wrote in message
...
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,





Gord Dibben

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,






All times are GMT +1. The time now is 02:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com