Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recording macro to save file with name change
I have recorded a macro that will make multiple formatting changes to a .csv
file and then save it in a new directory. The newly created file will have a new file name each day based on the current date. For example, todays new file is "Outbound 02-22-07" and tomorrows will be "Outbound 02-23-07" etc. But when I look in the VBA editor, the code is specific to the file name at the time the macro was recorded. Is there a way to have the macro save it with a variable filename as I have outlined above? Any help would be appreciated - this is my jump into using macro's. With Best Regards, Jon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recording macro to save file with name change
replace the line with the hard-coded filename to something like:
ActiveWorkbook.SaveAs "Outbound " & Format (Now, "mm-dd-yy") On Feb 22, 2:38 pm, jmcclain wrote: I have recorded a macro that will make multiple formatting changes to a .csv file and then save it in a new directory. The newly created file will have a new file name each day based on the current date. For example, todays new file is "Outbound 02-22-07" and tomorrows will be "Outbound 02-23-07" etc. But when I look in the VBA editor, the code is specific to the file name at the time the macro was recorded. Is there a way to have the macro save it with a variable filename as I have outlined above? Any help would be appreciated - this is my jump into using macro's. With Best Regards, Jon |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Recording macro to save file with name change
activeworkbook.SaveAs "C:\Myfolder\Outbound " & format(date,"mm-dd-yy") &
".csv", xlCSV or to save it as a workbook: activeworkbook.SaveAs "C:\Myfolder\Outbound " & format(date,"mm-dd-yy") & ".xls", xlWorkbook -- Regards, Tom Ogilvy "jmcclain" wrote: I have recorded a macro that will make multiple formatting changes to a .csv file and then save it in a new directory. The newly created file will have a new file name each day based on the current date. For example, todays new file is "Outbound 02-22-07" and tomorrows will be "Outbound 02-23-07" etc. But when I look in the VBA editor, the code is specific to the file name at the time the macro was recorded. Is there a way to have the macro save it with a variable filename as I have outlined above? Any help would be appreciated - this is my jump into using macro's. With Best Regards, Jon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Recording a macro to change item selected in drop down list | Excel Worksheet Functions | |||
Saving a file while recording a macro | Excel Discussion (Misc queries) | |||
how do I change macro relative reference? no stop recording tool | Excel Discussion (Misc queries) | |||
Recording a macro to open a large fixed-width text file | Excel Programming | |||
Save File to Another Directory, but not change Users File Save location | Excel Programming |