Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic File Names
I am trying to create a backup file using an autoexec macro, but am
unable to find the command to put in the macro to create the file name. I need to have the file name auto-incremental depending on what name is in the folder. Could anyone also tell me how to create the file name as the current date.. Thanks. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic File Names
Hello Chris,
How about this. It doesn't go and look in the folder for what is already there, but it saves your active workbook as for example "BACKUP 080629.xls" inside the folder you specify. If you really want to get it to look in the folder to see what is there, then add one, post the question under excel programming. ActiveWorkbook.SaveAs Filename:="\\SERVER\FOLDER\"BACKUP" & Format(Year(Now) - 2000, "00") & Format(Month(Now), "00") & Format(Day(Now), "00") & ".xls" HTH --- Allllen "chrismusic79" wrote: I am trying to create a backup file using an autoexec macro, but am unable to find the command to put in the macro to create the file name. I need to have the file name auto-incremental depending on what name is in the folder. Could anyone also tell me how to create the file name as the current date.. Thanks. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic File Names
I think I'd use the time and date. It makes your code easier and even allows
you to know when the save took place based on the filename itself. dim myFileName as string with activeworkbook myfilename = left(.fullname,len(.fullname)-4) & _ "_" & format(now,"yyyymmdd_hhmmss") & ".xls" .savecopyas myfilename end with chrismusic79 wrote: I am trying to create a backup file using an autoexec macro, but am unable to find the command to put in the macro to create the file name. I need to have the file name auto-incremental depending on what name is in the folder. Could anyone also tell me how to create the file name as the current date.. Thanks. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
some kind of meta-way to refer to sheet and file names in Excel? | Excel Discussion (Misc queries) | |||
I can't save long file names, only short one, how can I do this? | Excel Discussion (Misc queries) | |||
Weird File Open/Save As Behavior | Excel Discussion (Misc queries) | |||
Blank File Names spinner | Excel Discussion (Misc queries) | |||
Links picking up values from an older version of linked file | Links and Linking in Excel |