Is this poosible - a macro to 'Save As' with incremental date

Mel Smith

Well-known Member
Joined
Dec 13, 2005
Messages
1,041
Office Version
  1. 365
Platform
  1. Windows
I am trying to automate the extraction/copying of data from a master workbook into a 'daily' workbook. The copying and pasting etc. I can do but what I would also like to include in my code is to do a Save As of my 'new' daily workbook with each days date. So today it will be called MRE_040118, tomorrow MRE_050118 and so on. Is this possible?

Mel
 
Try
Code:
Sub Chk()
   Dim Fname As String
   Fname = ActiveWorkbook.Name & Format(Date, "ddmmyy")
   ActiveWorkbook.SaveAs "C:\Users\[COLOR=#ff0000]Fluff[/COLOR]\Documents\" & Fname, 52
   
End Sub
Change the value in red to your username
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Fluff, sorry - me again.

The code works and saves the file to the correct place. Unfortunately, when I go to this new file's location to open the new file, I cannot. It doesn't appear to be saved to any particular file format and when I try to open it I am directed to the App Store but that doesn't bring up Excel as an option...
 
Upvote 0
I changed the last line to read:

& Fname, xlsm and this seems to have worked. Thanks for your help.

Mel
 
Upvote 0
I still can't get this to work. The line that is the problem is: ActiveWorkbook.SaveAs "C:\Users\Fluff\Documents" & Fname, 52

Using this line the workbook saves but not in any usable format. I'm trying to get it to Save As ....Documents" & Fname.xlsm

Can anyone help, please?
 
Upvote 0
Not sure why that's not working for you, but try
Code:
Sub Chk()
   Dim Fname As String
   Fname = ActiveWorkbook.Name & Format(Date, "ddmmyy") & ".xlsm"
   ActiveWorkbook.SaveAs "C:\Users\Fluff\Documents\" & Fname, 52
   
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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