Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change Filename
I want to create a macro that will save a Workbook with the origina
workbook name at the start and then the current date and other tex behind. For example if my workbook is named "Financial Model.xls" I want the macro to add two parts to this file name, - first, the current date in this format 2004-08-11, - second, text such as "Final" Therfore, in this example I want: - "Financial Model.xls" to be saved as . . . - "Financial Model, 2004-08-11, Final.xls" I'm using this in combination with a macro that will convert all dat in the spreadsheet to values only (done through copy, paste special values) Any help is much appreciated -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change Filename
Hello Planner
Dim ActName As String Dim MyNewName As String ActName = ActiveWorkbook.Name MyNewName = Left(ActName, Len(ActName) _ - 4) & "_" & Format(Date, "yyyy-mm-dd") _ & "_" & "Final.xls" ActiveWorkbook.SaveAs MyNewName NB: you cant use commas in your file name so I replaced them with "_" (underscore) HTH Cordiallly Pascal "Planner " a écrit dans le message de ... I want to create a macro that will save a Workbook with the original workbook name at the start and then the current date and other text behind. For example if my workbook is named "Financial Model.xls" I want the macro to add two parts to this file name, - first, the current date in this format 2004-08-11, - second, text such as "Final" Therfore, in this example I want: - "Financial Model.xls" to be saved as . . . - "Financial Model, 2004-08-11, Final.xls" I'm using this in combination with a macro that will convert all data in the spreadsheet to values only (done through copy, paste special, values) Any help is much appreciated. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change Filename
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change Filename
You're welcome and thanks for your feedback!
Cordially Pascal "Planner " a écrit dans le message de ... Papou, Thanks, That is exactly what I was after! --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change Filename in Macro | Excel Discussion (Misc queries) | |||
Recorded macro: What happens if I change filename? | Excel Discussion (Misc queries) | |||
Macro to open SaveAs... and change filename to cell value | Excel Programming | |||
Toolbar Buttons (macros) fail after filename change | Excel Programming | |||
Save file, refer filename to cell and change directory | Excel Programming |