+ Reply to Thread
Results 1 to 4 of 4

Vba to save a file to a folder with the file name plus a sequential number

  1. #1
    Forum Contributor
    Join Date
    10-13-2015
    Location
    California
    MS-Off Ver
    Office 2013
    Posts
    138

    Vba to save a file to a folder with the file name plus a sequential number

    Hello,

    I have a dashboard file that incorporates a number of user forms. I have created a new form that will dump data to a workbook and save to a folder as filename.xlsx... what I need is for that file name to contain a sequential number at the end and for vba to check the folder for the latest filename (number) and add one to that number at time of run as multiple people can access the dash board at the same time so I cannot have vba just remember a variable as that could result in a duplicate number being used. The only files that will be saved in this specific folder will be exports from this user form.

    Please advise how you would go about this.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Vba to save a file to a folder with the file name plus a sequential number

    I have an API that uses Windows naming convention.

    What is "your" naming convention?
    e.g.
    1. ken.xlsm, ken_1.xlsm
    2. ken_1.xlsm, ken_2.xlsm
    3. ken.xlsm, ken (1).xlsm
    4. ken (1).xlsm, ken (2).xlsm
    etc.

  3. #3
    Forum Contributor
    Join Date
    10-13-2015
    Location
    California
    MS-Off Ver
    Office 2013
    Posts
    138

    Re: Vba to save a file to a folder with the file name plus a sequential number

    I figured out a solution by just counting the files in the folder and converting the count to an integer adding one each time its run and using saveas(filename & filenumber) no one can delete these files so it shouldn't be a problem this way

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Vba to save a file to a folder with the file name plus a sequential number

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] macro to save file to specific folder with file name from cell reference
    By mezza89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2013, 11:32 AM
  2. [SOLVED] Need help to save file to new folder and delete old file using same file name
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2012, 11:16 PM
  3. Save file in sequential order within directory
    By Tom Brennan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-20-2012, 08:50 AM
  4. Replies: 0
    Last Post: 04-16-2012, 10:57 AM
  5. Save file with sequential numbers
    By ElizaD01 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-16-2010, 02:08 PM
  6. Replies: 6
    Last Post: 08-11-2006, 03:41 PM
  7. Save file as sequential
    By psipsi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-06-2005, 06:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1