Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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,


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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,



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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,




  #5   Report Post  
Posted to microsoft.public.excel.programming
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,




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove Modules not working Noemi Excel Programming 3 November 1st 06 07:21 AM
Public, Private, Event modules, Forms modules,,, Jim May Excel Programming 11 October 31st 05 03:12 AM
Basic question - modules and class modules - what's the difference? Mark Stephens[_3_] Excel Programming 9 May 8th 05 11:48 AM
When to code in sheet or userform modules and when to use modules Tony James Excel Programming 1 December 16th 04 10:02 PM
Remove code from all modules closes Excel Stuart[_5_] Excel Programming 0 June 30th 04 06:22 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"