Rename a file with different versions each time saved

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
682
Office Version
  1. 2019
Platform
  1. Windows
Hello,
I have a workbook that I want to save as (in the same folder) version1, then version2, then version3, etc. depending on how many times I save it. I want to keep the original file as is.
I want the version to increase by 1 each time its saved. So in the same folder I might see FileName (version1), FileName (version2), etc. The extension will be .xlsm

Thank you
 
Place the fncGetNextVersionNumber function in the same Workbook Code Module as the subAdHocSaveCopyAs procedure and let me know.

This is how I developed it and it works fine for me.
After investigating, I activated the Micro Scripting Runtime in the 2nd file, and it worked.
I didn't realize the References related to each workbook.
Problem Solved.
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I've add both GetNext function and AdHoc procedure to the Workbook Code Module in both testing files.
The first (NBA) works fine. But in the second, I receive an error: Compile error, and this line is highlighted-Dim objFSO As FileSystemObject, user defined type not defined
Set a reference to Microsoft Scripting Runtime by using
' Tools > References in the Visual Basic Editor (Alt+F11).
 
Upvote 0

Forum statistics

Threads
1,223,577
Messages
6,173,164
Members
452,504
Latest member
frankkeith2233

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