Run "Workbook Open" once
I would check to see if the workbook being opened has been saved once by
checking for a path.
If not, do the deed.
Private Sub Workbook_Open()
If ThisWorkbook.Path < "" Then
Exit Sub
'do the deed
End If
End Sub
Placed in Thisworkbook module of the Template
Gord Dibben MS Excel MVP
On Wed, 7 Apr 2010 15:36:11 -0700 (PDT), Pete_UK
wrote:
If, as part of your routine, you were to write the filename to a
specific cell in your workbook before saving, then you can test that
cell to see if it is empty - if so then run the rest of your macro, if
it is not empty then terminate the macro without asking for the
filename etc.
Hope this helps.
Pete
On Apr 7, 11:27*pm, David P. <David
wrote:
I have a template that when it opens it automatically runs a macro that
allows me to type in a text box what I want to save the file as and then
saves it in the directory where I want it saved. The problem is that once it
is saved I don't want it to run the macro again when I reopen that saved
file. Should I put in the code at the end some way to deactivate the macro so
that it no longer automatically runs when opening that newly saved file?
Thank you.
David P.
|