close

Hi,

I have 3 macros in 1 module and 1 macro (before print) in the
quot;ThisWorkbookquot;. Is there a way to delete all the macros automatically (with a
macro?!) in a workbook?

Thank you.

Hi Danny

Copy this macro in Module1
If you run it it delete the whole module

Add code to delete the code in the thisworkbook where it say

'
' your code
'

See Chip's site
www.cpearson.com/excel/vbe.htmSub TheMacro()
'
' your code
'
With ThisWorkbook.VBProject.VBComponents
.Remove .Item(quot;Module1quot;)
End With
End Sub--
Regards Ron de Bruin
www.rondebruin.nlquot;Dannyquot; gt; wrote in message ...
gt; Hi,
gt;
gt; I have 3 macros in 1 module and 1 macro (before print) in the
gt; quot;ThisWorkbookquot;. Is there a way to delete all the macros automatically (with a
gt; macro?!) in a workbook?
gt;
gt; Thank you.
Danny,

Try

With ActiveWorkbook.VBProject.VBComponents
.Remove .Item(quot;Module1quot;)
With .Item(quot;ThisWorkbookquot;).CodeModule
.DeleteLines 1, .CountOfLines
End With
End With

See www.cpearson.com/excel/vbe.htm for more info and examples.--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
quot;Dannyquot; gt; wrote in message
...
gt; Hi,
gt;
gt; I have 3 macros in 1 module and 1 macro (before print) in the
gt; quot;ThisWorkbookquot;. Is there a way to delete all the macros
gt; automatically (with a
gt; macro?!) in a workbook?
gt;
gt; Thank you.
Gentlemen:

Thanks a lot. Have a great weekend!

Regards,
Danny

quot;Chip Pearsonquot; wrote:

gt; Danny,
gt;
gt; Try
gt;
gt; With ActiveWorkbook.VBProject.VBComponents
gt; .Remove .Item(quot;Module1quot;)
gt; With .Item(quot;ThisWorkbookquot;).CodeModule
gt; .DeleteLines 1, .CountOfLines
gt; End With
gt; End With
gt;
gt; See www.cpearson.com/excel/vbe.htm for more info and examples.
gt;
gt;
gt; --
gt; Cordially,
gt; Chip Pearson
gt; Microsoft MVP - Excel
gt; Pearson Software Consulting, LLC
gt; www.cpearson.com
gt;
gt;
gt;
gt; quot;Dannyquot; gt; wrote in message
gt; ...
gt; gt; Hi,
gt; gt;
gt; gt; I have 3 macros in 1 module and 1 macro (before print) in the
gt; gt; quot;ThisWorkbookquot;. Is there a way to delete all the macros
gt; gt; automatically (with a
gt; gt; macro?!) in a workbook?
gt; gt;
gt; gt; Thank you.
gt;
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()