+ Reply to Thread
Results 1 to 5 of 5

Revision Numbering File Name?

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    lodon
    MS-Off Ver
    Excel 2010
    Posts
    3

    Revision Numbering File Name?

    Hi,

    New here and got what I thought was a simple problem to solve that is driving me mad. I have a file with numerical values that often change. I want to set up my file so that every time I save it changes to a new number so that over time I can reflect back.

    I think I would prefer to keep the revision to a simple number rather than date. For example if the file name was 'test', then I would like it to go 'Test 1, then test 2', with the highest number being the newest. If date stamp is the only option I would live with it.

    Hope this makes sense and any help appreciated. Going mad.....

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Revision Numbering File Name?

    One suggestion. Create a new sheet (sample is Sheet 3). Down Column A list consecutive numbers. Then maybe something like this.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-20-2013
    Location
    lodon
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Revision Numbering File Name?

    Did a quick test and it seems to work. Sadly the spreadsheet I was to use it on is on my work PC and that is now turned off and travelling early tomorrow so unlikely to get a chance to test till late tomorrow. Will let you know.

    Thanks

  4. #4
    Registered User
    Join Date
    05-20-2013
    Location
    lodon
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Revision Numbering File Name?

    Hi, I tried you code and nearly there. I made 2 changes. Sheet 1 is where the numbers are and I changed the file extension to .xlsx as I am using 2010. However it will save 'new file name-1' but when I try open that doc it says in Excel that it won't open the file as 'file format or file extension is not valid'? Do I have to keep in .xls file format?

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:="FILE LOCATION AND NAME" & " " & Sheets("Sheet1").Range("A1").Value & ".xlsx", _
    FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=False, CreateBackup:=False
    Sheets("Sheet1").Range("A1").Delete xlUp
    Application.DisplayAlerts = True
    End Sub

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Revision Numbering File Name?

    I have 2003 and I'm afraid I can help you with that part. I've never received that message. I think it may have to do with this portion of the code though -- FileFormat:=xlNormal, Password:="", WriteResPassword:="", _

    Try changing it back to xls. I'm sure some Guru on the board will have a better answer them I can provide.

    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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