Save a copy but keep original file open with same name.

TDPorter

New Member
Joined
Sep 13, 2011
Messages
12
Okay so I want to save a copy of my workbook with the file name being a combination of cells (AB8, AC8, AD8). The 1st cell used for the file name consists of the =Today() function, I think this might pose a problem. The other two cells are just text, no biggie. I also want to make it so the workbook doesn't change name as with the Save_As function. I want its file name to remain but save a copy under a different name using the cells. It would be nice if it would save the original just after creating the copy under a different name. Any suggestions?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
For instance:

Code:
With ActiveWorkbook
   .SaveCopyAs .Path & "\" & Format(Date, "yyyymmdd") & "-" & [AC8] & "-" & [AD8] & ".xlsm" 
End With
 
Upvote 0
I assume you are referring to a VBA method,

Try the SaveCopyAs method..


As far as the Today() function in the filename, you'll need to format it to not use / in the date. As / are not allowed in filenames..

Try something like

FORMAT(Range("AB8"),"mm-dd-yyyy")

That will use - instead of /


Hope that helps.
 
Upvote 0
Hi

You need to use VBA for this - you have the handy SaveCopyAs function:

Code:
With Sheets("Whatever")
  ThisWorkbook.SaveCopyAs Format(.Range("AB8").Value,"yyyy-mm-dd") & .Range("AC8").Value & .Range("AD8").Value
End With
 
Upvote 0
I believe it's working but how can I define the path that is will be saved at, I can't seem to find the files after running the macro, not on desktop or in MyDocuments. Almost there! Thank you for getting me this far....
 
Upvote 0
I believe it's working but how can I define the path that is will be saved at, I can't seem to find the files after running the macro, not on desktop or in MyDocuments. Almost there! Thank you for getting me this far....

If you had looked at my suggestion in detail, you would have noticed .Path in there. So it will be stored in the same directory as the ActiveWorkbook. (which is saved as a copy).
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top