#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Modules

I am trying to write a piece of VBA that takes a copy of a workbook, deletes
various sheets, deletes the module that is attached to the sheet and then
e-mails it to a list of recipients.

I have managed to acheive everything EXCEPT the deletion of the module. Can
anyone give me the code to delete "Module1" from my workbook using VBA.

Thanks,

Rich
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modules


Sub DeleteModule()
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("NewModule")
ThisWorkbook.VBProject.VBComponents.Remove VBComp
End Sub



You need to have the Microsoft Visual Basic For Application
Extensibility library activated in your references

--
ehnt
-----------------------------------------------------------------------
ehntd's Profile: http://www.excelforum.com/member.php...fo&userid=1586
View this thread: http://www.excelforum.com/showthread.php?threadid=27515

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
VB Modules dhstein Excel Discussion (Misc queries) 9 November 8th 08 09:46 PM
Help with modules. Cloudy New Users to Excel 1 June 17th 08 10:10 AM
Modules Norman Jones Excel Programming 0 July 29th 04 10:28 PM
modules that run modules jim Excel Programming 2 May 5th 04 08:10 PM
Class Modules vs Modules Jeff Marshall Excel Programming 2 September 28th 03 07:57 PM


All times are GMT +1. The time now is 03:20 AM.

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"