Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: How to timestamp a filename with macro

  1. #1
    Board Regular
    Join Date
    May 2002
    Posts
    91
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    I want to create a macro which just saves the current file with what ever the name is + the time stamp.

    Example.
    My file is "FILE.xls"

    in the FILE.xls there should be a macro
    which, when i run should Save As the file FILE.xls to FILE_05_11_02.xls
    (what ever the date i ran)

    thanks


  2. #2
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    version 1
    Code:
    Sub ReNameSvFile()
    Path = "c:"
    WkBkNm = (Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4))
    DateStr = Format(Date, "dd_mmm_yy")
    
        ActiveWorkbook.SaveAs Filename:= _
            Path & WkBkNm & DateStr & ".xls", FileFormat:=xlNormal, _
            Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
            CreateBackup:=False
    End Sub
    version 2

    Code:
    Sub ReNameSvFile()
    Path = "c:"
    WkBkNm = (Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4))
    DateStr = Format(Date, "dd_mmm_yy")
    
        ActiveWorkbook.SaveAs Filename:= _
            Path & WkBkNm & DateStr & ".xls", FileFormat:=xlNormal, _
            Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
            CreateBackup:=False
    End Sub
    [ This Message was edited by: Nimrod on 2002-05-10 21:36 ]

    [ This Message was edited by: Nimrod on 2002-05-10 22:10 ]

    [ This Message was edited by: Nimrod on 2002-05-10 22:11 ]

  3. #3
    Board Regular
    Join Date
    May 2002
    Posts
    91
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Can't it be done by a macro?

    if not, Where to put this code. can you tell me step by step


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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