ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   set filename to <filename-date on open (https://www.excelbanter.com/excel-worksheet-functions/98784-set-filename-filename-date-open.html)

bob engler

set filename to <filename-date on open
 
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...



Hayeso

set filename to <filename-date on open
 
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



"bob engler" wrote:

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...




bob engler

set filename to <filename-date on open
 
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.





"Hayeso" wrote in message
...
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



"bob engler" wrote:

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...







All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com