set filename to <filename-date> on open

B

bob engler

I would like to have the filename of a excel WB set to
<filename-currentdate> on open the original file so when
the people save it, it will save it to the new name. ie:

open MGA (template file) and make the active WB
MGA-071106 which is a copy of MGA.xls. That way when
the people click Save, it will save it to the new file (they
have problems following simple instructions.

Thanks...
 
H

Hayeso

Press Alt+F11 to go to the Microsoft Visual Basic Editor
Press CTRL+R to View the Project Explorer
Expand the MGA.xls Project and doubleclick the ThisWorkBook Object
Paste in the following code

Private Sub Workbook_Open()
With Me
.SaveAs .Path & "\MGA-" & Format(Now, "mmddyy") & ".xls"
End With
End Sub

Save and close your workbook
 
B

bob engler

Thanks, is there a way to replace the "\MGA" with the filename of the
opened
template file? I have different ones, MGA, RVA etc. Also, how do I set
the new file not to run the macro? I only want the people to have the macro
run from the template file. If they reopen a saved file, I want it to stay
as
that filename.
 

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