MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Delete Modules Or Macro's By Running A Macro


Posted by Ronald on October 09, 2001 2:03 AM

Can anyone tell me how to let Modules or Macro's be deleted by running a macro?

For example Macro1, Macro2 or Module1, Module2.

Hope someone can help me out?

Thanks

Ronald


Posted by Rachel on October 09, 2001 2:34 AM

Sub RemoveMe()
Dim folder as string
Dim myfile as string

'assign the name of the folder to the folder variable
'notice the ending backslash"\"
folder = "C:Abort\"
Myfile= dir(folder, vbNormal)
Do while myfile <>""
Kill folder & myfile
myfile = Dir
Loop
RmDir folder
End Sub


Hope this helps. You will need to amend it slightly for a file .

Posted by Ronald on October 09, 2001 4:37 AM

Thanks for your help but to be honest with you I don't know what to do. Can you tell me what I've gotta change myself into different values like folder or file name? Can you explain to me what it all does? Hope you can do this for me. Thanks.