LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 238
Default Deleting macros by running a macro?

I have been playing with this. From the archives. Deletes all macros.
Sometimes it deletes itself, sometimes it does not.Can it be fixed so
it always deletes itself?

Sub DeleteAllMacros()
Dim Composantvbe As Object
With ThisWorkbook.VBProject
For Each Composantvbe In .VBComponents
If Composantvbe.Type = 100 Then
With Composantvbe.CodeModule
.DeleteLines 1, .CountOfLines
.CodePane.Window.Close
End With
Else: .VBComponents.Remove Composantvbe
End If
Next Composantvbe
ActiveWorkbook.Save
ActiveWorkbook.Close
End With
End Sub


 
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
Excel Macro Security Problem - Trusted macros not running for users (but do run for domain admins) Alan Excel Programming 0 January 22nd 07 10:12 PM
Running Macros Links and Linking in Excel 3 July 13th 06 11:30 PM
How to stop file open macro prompt after deleting all macros? twor57 Excel Worksheet Functions 2 November 29th 05 05:00 PM
macro warning persists even after deleting all macros Todd Excel Discussion (Misc queries) 3 July 25th 05 10:12 PM
Running Macros Steve Excel Programming 5 September 21st 04 02:54 PM


All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"