Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Delete a module in VBA?

I use an Excel template with a lot of modules to produce a particular type
of report and when I have completed the workbook, I send it to others but do
not wish to include all the VBA modules. Therefore, in VBA, I manually
delete each module.

Is there a way to do this in VBA code?

Anybody got any good suggestions?
Look forward to response
Philip


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Delete a module in VBA?

Phillip,

See www.cpearson.com/excel/vbe.htm for detail about working with VBProject
objects and code with code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Philip Reece-Heal" wrote in message
. ..
I use an Excel template with a lot of modules to produce a particular type
of report and when I have completed the workbook, I send it to others but

do
not wish to include all the VBA modules. Therefore, in VBA, I manually
delete each module.

Is there a way to do this in VBA code?

Anybody got any good suggestions?
Look forward to response
Philip




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Delete a module in VBA?

From Chip
Deleting A Module From A Workbook

The procedure below will delete the module named "NewModule" from
ThisWorkbook.

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

You cannot delete the ThisWorkbook code module, or a sheet code module, or a
chart code module.


--
Don Guillett
SalesAid Software

"Philip Reece-Heal" wrote in message
. ..
I use an Excel template with a lot of modules to produce a particular type
of report and when I have completed the workbook, I send it to others but

do
not wish to include all the VBA modules. Therefore, in VBA, I manually
delete each module.

Is there a way to do this in VBA code?

Anybody got any good suggestions?
Look forward to response
Philip




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
code to delete module / macro in another file Ray Clark[_2_] Excel Discussion (Misc queries) 1 July 3rd 08 04:15 AM
Delete macro that is not in a module [email protected] Excel Discussion (Misc queries) 5 September 21st 07 06:15 PM
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
Delete a module Steve M Excel Discussion (Misc queries) 2 March 28th 05 02:59 PM
Delete userform/module using VB Rohit Thomas Excel Programming 5 July 16th 03 11:01 PM


All times are GMT +1. The time now is 04:49 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"