Macro to AutoSave Excel Spreadsheets Using Different File Names

amadams

New Member
Joined
Jun 15, 2024
Messages
1
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Mobile
  3. Web
I am working on a Spreadsheet for work for the safety checks we do every 15 minutes. I have it completed all except this last part. I need help with a Macro or something so that each spreadsheet opened will autosave using a different filename with the date of the spreadsheet autosaved in the filename. I will try to explain how I need this to work to the best of my ability. These are files that we must retain for a period of three months before we can delete them, so it is important that each completed spreadsheet autosaves and autosaves under a different filename so we can retain them for a period of three months.

Since we do these safety checks every 15 minutes and we do them each day of work, I need to find a way to autosave the Spreadsheet each day under a different filename. I do not need the spreadsheet filename to change each time it is autosaved, just need it to autosave using a different filename each day.
For example, I have one of the spreadsheets named 15MinSafetyChecksSA and I would like for this specific spreadsheet to remain blank. How can I get the next spreadsheet completed to autosave using the filename 15MinSafetyChecksSA-06-15-2024 then the next one to save as 15MinSafetyChecksSA-06-16-2024? If there is a way to add the date of the autosave to the spreadsheet filename when it is autosaved, this would be all I would need so that the files autosave using different filenames.

I appreciate any help if anyone is able to assist me with this. If needed, I can provide a link to the spreadsheet so you can take a look at what I currently have. I do have some other questions about Macros/VBA in Excel but since they are different questions, I will start a new thread for each one.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi *amadams and Welcome to the Board! I'm not sure why you haven't received any assistance with this one yet as it seems fairly straight forward. You will need to adjust the file path for an existing folder. This will rename the file every day but it won't auto save it every 15min (which I don't think you want?). To save every 15mins you would have to add a timer, and some code to start and stop the timer. HTH. Dave
VBA Code:
Dim StrPath As String, StrExt As String, NewFileName As String
StrPath = "C:\YourFolderName\15MinSafetyChecksSA" 'Change to suit
StrExt = ".xlsx" 'Change to suit
NewFileName = StrPath & "-" & Format(Date, "mm-dd-yyyy") & StrExt
'Save wb copy
MsgBox "The new FileName is: " & NewFileName
'ActiveWorkbook.SaveCopyAs newFileName
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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