Change pre defined "Save as" structure

  • Hi everyone,


    I am new to the forum and must admit upfront, that I am only looking for one time help and won't contribute much to the community. I do not know any VBA and am trying to adjust an add-in I am using to my needs. So I hope you appreciate my honesty - and maybe the code will help someone in the future.


    Let's assume we have a worksheet called "Example" created by user Jon Doe (JD) am 13th January 2021.

    So the add-in has a button, where when you click it, it saves the the workbook as "Example_2021_01_13_v01_JD" in its current location. If you had never saved the workbook before, it will ask you where you want to save it. If you click the button again, it will update the date - if changed - an move to v02..


    I am looking to change this format to "210113_Example_v01_JD"


    So again - apologies for having such a blunt request, basically looking for someone to rewrite the code for me to copy&paste. I would really appreciate the help!


    Best regards,

    Diggmau$


  • Many thanks for your reply! Well, I can change the code - already tried and got it to save a file in my desired format if it has never been saved before. But it gets tricky for me after that.


    Thank you and best regards

    Diggmau$

  • No error messages, but the following happens:


    - I create a new unsaved Excel file "Book1"

    - I hit the "Save as" button of the Add-in

    - Normally a "Save as" dialogue box will open, asking me where I want to save the file and with the following naming suggestion "Book1_2021_01_14_v01_JD"

    - I succeeded in changing that to "210114_Book1_v01_JD"


    - I hit the "Save as" button of the tool again tomorrow

    - Normally it would now automatically save as "Book1_2021_01_15_v02_JD" in the same location

    - What happens now after my edit is, that it saves it as "210114_Book1_v01_JD_2021_01_15_v01_JD"

    - But I would like it to save as "210115_Book1_v02_JD"


    Kind regards

    Diggmau$

  • I am not trying to do that. In any case the version counter "_v01_" would be updated to +1..so "_v02_"

    If the current date is different from the one in the filename, then also the date is updated

  • Right now the add-in constructs it as "Book1_yyyy_mm_dd_v##_JD" with ## going +1 everytime the file is saved and JD being the User initials


    I'd like it to construct it as "yymmdd_Book1_v##_JD"