Do not save macro with workbook

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I have a template with a startup macro in it and I would like to not save the
macro when they save the workbook. There are other macros in there that I
would like to save with the file. Any good ideas? Thanks! Jeff
 
You could remove the macro, but that would depend on what the user's security
settings are.

Since you're keeping other macros, why not just make it so that it doesn't run?

Sub Workbook_Open()
if me.path <> "" then
exit sub
end if

'real code here
End sub

Or

Sub Auto_Open()
if thisworkbook.path <> "" then
exit sub
end if

'real code here
End sub
 
That will work. Thanks you Dave!

Dave Peterson said:
You could remove the macro, but that would depend on what the user's security
settings are.

Since you're keeping other macros, why not just make it so that it doesn't run?

Sub Workbook_Open()
if me.path <> "" then
exit sub
end if

'real code here
End sub

Or

Sub Auto_Open()
if thisworkbook.path <> "" then
exit sub
end if

'real code here
End sub
 
Back
Top