Saving file without macros

  • Thread starter Thread starter Paul_Russell
  • Start date Start date
P

Paul_Russell

I run a report every morning and have written some code to save the
report with today's date.
However every file that has been saved contains all the macros that
were in the template.
Is there an easy way to save files without saving the macros?

Cheers
Paul
 
Hi Paul

You can run a macro that delete the whole module where
you store the macro's.
The macro you run is also in this module

Sub deletemodule()
With ThisWorkbook.VBProject.VBComponents
.Remove .Item("Module1")
End With
End Sub
 
I am trying to work through a similar situation. I have a workbook that generates a copy of itself. I would like the copy to be as streamlined as possible, so I would like to delete the excess sheets and code

All code in the workbook is within Module1. Module1 is triggered by a Command Button
Would like Module1 to do the following..
1.)All it processin
2.)Delete unneeded sheet
3.)Save the new workboo
4.) delete itself and save again

Everything works except item 4. I currently have the delete routine as the second to last thing in Module1. It is bombing out


----- Ron de Bruin wrote: ----

Hi Pau

You can run a macro that delete the whole module wher
you store the macro's
The macro you run is also in this modul

Sub deletemodule(
With ThisWorkbook.VBProject.VBComponent
.Remove .Item("Module1"
End Wit
End Su
 
Back
Top