Delete Macros Macro

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

I have some xl files that have many macros in them. For
example 20 xl files with 10 macros in each file.

I have the following macro in it's own xl file that I use
to delete the macros in the other files before I save the
xl files in another directory.

Sub zzzDeleteMacros()
Dim vStop As Double
vStop = 0
Do Until vStop = 50
Application.SendKeys Keys:="%tmm", Wait:=False
Application.SendKeys Keys:="%D", Wait:=False
Application.SendKeys Keys:="Y", Wait:=False
vStop = vStop + 1
Loop
End Sub

This works fine except that it also will delete the macro
zzzDeleteMacros(). Then I just do not save the delete
macro file. It's name is zzzDeleteMacros() because I want
it to be the last macro in the list of approx 200 or more
macros.

Is there a way to ask the name of the macro selected in
the Macro Run Dialog box so that when it gets to
zzzDeleteMacros() I can show a message "Process Complete"
and then Exit Sub.

Thank you for your help.

Steven



..
 
I think I'd put the code to delete the macros into a different workbook (and
save that workbook elsewhere).

But instead of using sendkeys, I'd steal some code from Chip Pearson's page:

http://www.cpearson.com/excel/vbe.htm

In fact, if those macros are all the same, you may want to think about putting
them in a separate workbook and running them from there. Then each of the
"data" workbooks could be without macros.
 
Back
Top