excel vba macro, run only once
Posted on 2011-03-04
I have a server delivering an Excel file to the browser.
I have included some (novice-level but adequate) macro code to set appropriate attributes on each sheet of the file, to control online display and printing. I want the macro to run when the file is delivered to the browser, but not to run again if the user saves the document and later re-opens it.
(It's a WebFocus application; the macro comes from a template .mht document stored on the server.)
What mechanicsm can be used?
If there is a way for the auto_open macro to delete itseft, that would do it. Otherwise, it will have to sense whether to proceed or quite -- I would want to have the first-time-only detection encapsulated in a function, so I can readily re-use it.