Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Modules in Macro
The macro recorder does not record the mouse clicks to Delete a Module.
How can I delete modules via a macro? Thanks, Mark |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Modules in Macro
Visit Chip Pearson's site to find out how:
http://www.cpearson.com/excel/vbe.htm Mark wrote: The macro recorder does not record the mouse clicks to Delete a Module. How can I delete modules via a macro? Thanks, Mark -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Modules in Macro
Mark,
Here is an example for Module2 Dim VBComp As Object Set VBComp = ThisWorkbook.VBProject.vbcomponents("Module2") ThisWorkbook.VBProject.vbcomponents.Remove VBComp -- HTH RP (remove nothere from the email address if mailing direct) "Mark" wrote in message ... The macro recorder does not record the mouse clicks to Delete a Module. How can I delete modules via a macro? Thanks, Mark |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Modules in Macro
I'd like to remove all the modules in a workbook.
Would you have some sample code to iterate through the modules within a workbook? Thank you - your posts are very helpful. Mark "Bob Phillips" wrote: Mark, Here is an example for Module2 Dim VBComp As Object Set VBComp = ThisWorkbook.VBProject.vbcomponents("Module2") ThisWorkbook.VBProject.vbcomponents.Remove VBComp -- HTH RP (remove nothere from the email address if mailing direct) "Mark" wrote in message ... The macro recorder does not record the mouse clicks to Delete a Module. How can I delete modules via a macro? Thanks, Mark |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Modules in Macro
Mark,
This will remove all modules. You cannot remove Sheet or Thisworkbook modules. Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.vbcomponents If vbMod.Type = 1 Then ' a module ThisWorkbook.VBProject.vbcomponents.remove vbMod End If Next vbMod -- HTH RP (remove nothere from the email address if mailing direct) "Mark" wrote in message ... I'd like to remove all the modules in a workbook. Would you have some sample code to iterate through the modules within a workbook? Thank you - your posts are very helpful. Mark "Bob Phillips" wrote: Mark, Here is an example for Module2 Dim VBComp As Object Set VBComp = ThisWorkbook.VBProject.vbcomponents("Module2") ThisWorkbook.VBProject.vbcomponents.Remove VBComp -- HTH RP (remove nothere from the email address if mailing direct) "Mark" wrote in message ... The macro recorder does not record the mouse clicks to Delete a Module. How can I delete modules via a macro? Thanks, Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic Protection and Delete Modules | Excel Discussion (Misc queries) | |||
Delete Code Modules Programatically | Excel Discussion (Misc queries) | |||
When to code in sheet or userform modules and when to use modules | Excel Programming | |||
Delete modules programmatically and save | Excel Programming | |||
Delete Modules and Userforms | Excel Programming |