Save Backup Workbook With Macro
Results 1 to 6 of 6

Thread: Save Backup Workbook With Macro

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

    Default Save Backup Workbook With Macro

    Hello there,

    I'm trying to find a macro that I can add to my quick access toolbar to be able to save the file as, with the current file name and the date and time added.
    to this path
    C:\Users\wwollaston\Documents\Files\Backups\


    For Example,

    I'm in a workbook named Workbook1 and I run the macro, now I should have a file saved here
    C:\Users\wwollaston\Documents\Files\Backups\Workbook1 8.6.2019 3:32PM.xlsx

  2. #2
    Board Regular lrobbo314's Avatar
    Join Date
    Jul 2008
    Location
    California
    Posts
    2,381
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Save Backup Workbook With Macro

    Does this work? You can't have : in a file name, so the time is separated by a period.

    Code:
    Sub Backup()
    Dim path As String: path = "C:\Users\wwollaston\Documents\Files\Backups\"
    ThisWorkbook.SaveAs path & "Workbook1 " & Format(Now(), "m.d.yyyy h.nn am/pm") & ".xlsm", xlOpenXMLWorkbookMacroEnabled
    End Sub
    To add code to a workbook. Hit Alt+F11. Hit Alt+I+M to insert new module. Then paste code.
    Array formulas must be entered by hitting Ctrl+Shift+Enter.

    We can't solve problems by using the same kind of thinking we used when we created them.

    Imagination is more important than knowledge.

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

    Default Re: Save Backup Workbook With Macro

    Hey thanks a lot for helping me lrobbo, your code helped me find exactly how to do what I wanted!

  4. #4
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,442
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Save Backup Workbook With Macro

    You can try my addin for this if you like

    http://trypots.net/srv/xl-bk.html

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

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

    Default Re: Save Backup Workbook With Macro

    Quote Originally Posted by xenou View Post
    You can try my addin for this if you like

    http://trypots.net/srv/xl-bk.html
    Thank you Xenou!
    That's really cool how the original file doesn't get saved and only the backup file will get the edited parts, that's how I was trying to set mine up, but couldn't figure it out.
    I appreciate you sharing this with me!

  6. #6
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,442
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Save Backup Workbook With Macro

    great I'm glad it's helping out.

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

Some videos you may like

User Tag List

Tags for this Thread

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
  •