Do not save macro with workbook

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
 
D

Dave Peterson

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
 
J

Jeff

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top