Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 24th, 2004, 12:35 AM
Authorized User
 
Join Date: Feb 2004
Location: , , Denmark.
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default Removal of modules

Hi
I can remove lines in CodeModule by using the following syntax

For I = 1 To 3
Application.VBE.SelectedVBComponent.CodeModule .DeleteLines (1), 1
Next

But actually I would like to remove the whole module, does anyone know how to do this, if posssible ?

Cheers
Karsten

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.
Sub DeleteModule()
  Dim VBComp As VBComponent
  Set VBComp = ThisWorkbook.VBProject.VBComponents("Module2")

  ThisWorkbook.VBProject.VBComponents.Remove VBComp
End Sub

Cheers
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic history removal ermy78 SQL Server 2005 0 February 18th, 2008 02:41 PM
namespace removal manish_jaiswal XSLT 5 February 15th, 2008 05:40 AM
Close button removal canuck38 Access 4 July 16th, 2004 03:50 AM
Chapt 6 Removal from an ArrayList Jerry Obrien BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 February 19th, 2004 02:40 PM



All times are GMT -4. The time now is 11:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.