Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Remove Modules

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pedro Serra - 25 Sep 2007 11:22 GMT
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 - 25 Sep 2007 11:26 GMT
All explained nicely here:
http://www.cpearson.com/excel/vbe.aspx

RBS

> 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?
[quoted text clipped - 4 lines]
>
> Thanks,
Pedro Serra - 25 Sep 2007 13:54 GMT
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,

> All explained nicely here:
> http://www.cpearson.com/excel/vbe.aspx
[quoted text clipped - 9 lines]
> >
> > Thanks,
RB Smissaert - 25 Sep 2007 15:33 GMT
Did you set the reference to the VBE Extensibility as explained in that
link?

RBS

> I'm trying to put the following code avalaible in the link u send me, but
> I
[quoted text clipped - 27 lines]
>> >
>> > Thanks,
Gord Dibben - 25 Sep 2007 15:54 GMT
You must have the Visual Basic for Applications Extensibility Libray referenced
under Tools>References.

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

Gord Dibben  MS Excel MVP

>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!
[quoted text clipped - 25 lines]
>> >
>> > Thanks,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.