Results 1 to 10 of 27

Thread: Save Workbook File With The Next Incrementing Version Number Index

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    Code:
    Sub saveProgressiveNumber()
    Dim fs, snum As String
    Set fs = CreateObject("Scripting.FileSystemObject")
    Fname = "Ivan Ivanov-" ' the name must end with -
    fpath = "your path\"
    If Dir(fpath & "*.xls*") = "" Then
      ThisWorkbook.SaveAs (fpath & Fname & "0001.xlsm")
    Else
      Set f = fs.GetFolder(fpath)
      Set NFile = f.Files
      For Each pf1 In f.Files
        date3 = pf1.DateLastModified
        Fname1 = pf1.Name
        If MDataUM < date3 Then
          FpathName = pf1
          MDataUM = date3
          fnameExt = Fname1
        End If
      Next
      fnum = Val(Mid(FpathName, InStr(FpathName, "-") + 1, 4)) + 1
      snum = Format(fnum, "0000")
      ThisWorkbook.SaveAs (fpath & Fname & snum & ".xlsm")
    End If
    End Sub
    Last edited by patel; 07-14-2013 at 09:14 PM.

Similar Threads

  1. Replies: 4
    Last Post: 06-20-2013, 04:25 PM
  2. Replies: 7
    Last Post: 04-21-2013, 07:50 PM
  3. How To Save Macro To Personal Workbook
    By NITIN SHETTY in forum Excel Help
    Replies: 1
    Last Post: 04-07-2013, 01:07 PM
  4. Copy Sheets To New Workbook And Save
    By Prabhu in forum Excel Help
    Replies: 5
    Last Post: 09-06-2011, 09:35 PM
  5. Replies: 1
    Last Post: 06-02-2011, 10:38 AM

Posting Permissions

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