Automate Backup of Current File Quickly

How to automate backup of current file quickly and easily with VBA. Many times we wish to work with our current data using a new macro. If we are not 100% confident what exact action the macro will do and are doubtful about losing our precious data then it’s a good idea to backup the file or save a copy of that file. Watch the video to learn how the process of backup is automated with VBA:

Watch this video on YouTube.

Here’s the complete VBA code to automate the backup of the file currently in use:

Sub fileBackUp()
MsgBox ThisWorkbook.Path
Dim reply As Integer
reply = MsgBox(“Want to take a backup?”, vbYesNo)
If reply = vbYes Then
ThisWorkbook.SaveCopyAs Filename:=ThisWorkbook.Path & “\” & Format(Date, “mm-dd-yyyy”) & “_” & ThisWorkbook.Name
End If
End Sub

Sample file for download and practice:

Published by

Dinesh Kumar Takyar

Welcome to! My aim is to help you learn MS Excel including VBA. I always felt that a good way to learn something was to find solutions to problems in that domain. That is why I share these Excel videos with you. Mostly these are questions asked during my corporate training sessions. I've been training individuals and companies in computers since 1991. I did my B. Sc. (Vordiplom), M. Sc. (Diplom) and Ph.D. (Dr. rer. nat.) from Hamburg, Germany. The best thing about solving some of my visitor's questions is that I also gain new insights. For more Excel VBA solutions you may like to visit my YouTube channel: For a structured Excel VBA training course online you can visit:

One thought on “Automate Backup of Current File Quickly”

  1. Very handy utility. I will be using this in some of my macros as a security measure.

    Thank You for all your work and sharing with us.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.