Saving Excel File Path Creation

Strider89

New Member
Joined
Dec 28, 2017
Messages
22
I don't know if this is even possible. I am in charge of our template for work. I need to make sure our files are being saved properly and to a secure location. Right now, the workbook will save itself when certain cells are filled, and will autosave to a specific location every 20 minutes, and then save again when the file is closed. The file path is a specific location, so if the user does save as, they will be able to still select other locations to save their project.

Here's the rub. The file path is set to a folder named by quarter, in another folder named by year. I don't want to have to change the code every quarter. Is there a way that Excel, upon saving, can check the file path to see if it is the right one? And if that file path doesn't exist, create a folder for it to save itself in?

Here's what I'm thinking (no code, because I don't know where to start.)
In the workbook
  • Dim Year as String, then somehow set it to the current year.
  • Set January 1st through March 31st as Q1, April 1st through June 30th as Q2, and so on.
  • Check to see if C:\\Reports\YEAR\Q# exists as a file path to save
  • If yes, save to that file path
  • If not, create the path and save itself to that path
  • The file will ultimately sort itself into a location.

I'm sure some of this is beyond the scope of Excel, but I am hoping that someone here can help me figure this out.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Also, the save feature cannot change the directory. If the user does Save As to a specific location, this script should not override their file path when they click Save. That is to say, the user should not have to use the Save As feature to constantly reset their file path every 20 minutes.
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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