Excel VBA -delete or change text in a module

Hi

What VBA code would I use to change the text in a module or delete that module?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
 
jppintoCommented:
Here's the code to delete a VBA module.

jppinto
Sub DeleteThisModule()
Dim vbCom As Object
If MsgBox("Are you aure you want to delete Module1?", vbYesNo, "Delete Module1?") = vbYes Then
    Set vbCom = Application.VBE.ActiveVBProject.VBComponents
    vbCom.Remove VBComponent:= _
    vbCom.Item("Module1")
Else
End If
End Sub

Open in new window

0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
http://www.cpearson.com/excel/vbe.aspx

Is a starter for code automation.  If you want specific help then of course please ask.

Chris
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
thanks very much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.