Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Danny
 
Posts: n/a
Default VBA, delete all macro

Hi,

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

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron de Bruin
 
Posts: n/a
Default VBA, delete all macro

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
http://www.cpearson.com/excel/vbe.htm


Sub TheMacro()
'
' your code
'
With ThisWorkbook.VBProject.VBComponents
.Remove .Item("Module1")
End With
End Sub





--
Regards Ron de Bruin
http://www.rondebruin.nl


"Danny" wrote in message ...
Hi,

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

Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Chip Pearson
 
Posts: n/a
Default VBA, delete all macro

Danny,

Try

With ActiveWorkbook.VBProject.VBComponents
.Remove .Item("Module1")
With .Item("ThisWorkbook").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



"Danny" wrote in message
...
Hi,

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

Thank you.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Danny
 
Posts: n/a
Default VBA, delete all macro

Gentlemen:

Thanks a lot. Have a great weekend!

Regards,
Danny

"Chip Pearson" wrote:

Danny,

Try

With ActiveWorkbook.VBProject.VBComponents
.Remove .Item("Module1")
With .Item("ThisWorkbook").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



"Danny" wrote in message
...
Hi,

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

Thank you.




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
Macro to Delete blank cells GarToms Excel Worksheet Functions 1 January 26th 06 07:39 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Error when trying to delete a macro... Currie Excel Discussion (Misc queries) 5 July 6th 05 07:31 PM
Can't find macro in an Excel file to delete it Ron Excel Discussion (Misc queries) 3 July 1st 05 01:07 PM
Macro data selection line delete Frantic Excel-er Excel Discussion (Misc queries) 0 May 31st 05 11:46 PM


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