Delete Macro from Excel Workbook

SiGill

Registered User.
Local time
, 16:50
Joined
Dec 22, 2008
Messages
72
Hi
I have some vba in access that exports data to an excel workbook, runs the macro in that workbook, then does a save as. Thing is it also saves the macro when it does the save as. Is there a way I can delete the macro after the save as?

Hope that makes sense.

Many Thanks

Simon
 
Ive not tested this but you can delete the whole module sheet with this code.

Sub DeleteThisModule()
Dim vbCom As Object
MsgBox "Hi, I will delete myself "
Set vbCom = Application.VBE.ActiveVBProject.VBComponents vbCom.Remove VBComponent:= _
vbCom.Item("Module1")
End Sub
 

Users who are viewing this thread

Back
Top Bottom