Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

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

  1. #21
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    attach please your file

  2. #22

  3. #23
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    You may also try this one.

    Code:
    Sub kTest()
        
        Dim strFName        As String
        Dim strExtn         As String
        Dim strPath         As String
        Dim lngFNum         As Long
        Dim nmFNum          As Name
        
        Const FName = "ivan ivanov"
        
        On Error Resume Next
        Set nmFNum = ThisWorkbook.Names("FNum")
        On Error GoTo 0
        
        If nmFNum Is Nothing Then
            Set nmFNum = ThisWorkbook.Names.Add("FNum", 1, 0)
            lngFNum = 1
        Else
            lngFNum = Evaluate("FNum") + 1
            nmFNum.RefersTo = lngFNum
        End If
        
        strFName = ThisWorkbook.FullName
        strExtn = Mid$(strFName, InStrRev(strFName, "."))
        strPath = Left$(strFName, InStrRev(strFName, "\"))
        
        ThisWorkbook.SaveCopyAs strPath & FName & lngFNum & strExtn
        
    End Sub
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  4. #24
    Member
    Join Date
    Nov 2012
    Posts
    47
    Rep Power
    0
    Yes, yes, this is exactly what I wanted. That's what's
    Infinitely many thanks. You are just amazing, so much that I can not even describe it and to express it in words.
    Thank you very much.
    Admin - thus giving my reputation, because when you press the asterisk does not allow me to give you the necessary points.
    Screen_03 Jul. 16 20.50.jpg
    Last edited by k0st4din; 07-16-2013 at 10:53 PM.

  5. #25
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    Admin
    very interesting code, can you comment it ?

  6. #26
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Quote Originally Posted by patel View Post
    Admin
    very interesting code, can you comment it ?
    Hi

    here you go.

    Code:
    Sub kTest()
        
        Dim strFName        As String
        Dim strExtn         As String
        Dim strPath         As String
        Dim lngFNum         As Long
        Dim nmFNum          As Name
        
        Const FName = "ivan ivanov"
        
        On Error Resume Next
        Set nmFNum = ThisWorkbook.Names("FNum")     'a defined name
        On Error GoTo 0
        
        If nmFNum Is Nothing Then 'for the first time we have to add the name
            Set nmFNum = ThisWorkbook.Names.Add("FNum", 1, 0)   'add the defined name for the first time (0 - visible=false)
            lngFNum = 1
        Else
            lngFNum = Evaluate("FNum") + 1 'get the previous number + 1
            nmFNum.RefersTo = lngFNum   'assign the new number
        End If
        
        strFName = ThisWorkbook.FullName
        strExtn = Mid$(strFName, InStrRev(strFName, "."))
        strPath = Left$(strFName, InStrRev(strFName, "\"))
        
        ThisWorkbook.SaveCopyAs strPath & FName & lngFNum & strExtn
        
    End Sub
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  7. #27
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    Than you, I understand now, I think it would be better a visible name, very good idea.

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
  •