Results 1 to 12 of 12

Automatically creating a back copy in other location which is updated at all times

Threaded View

KK1234 Automatically creating a back... 03-09-2013, 10:06 AM
JBeaucaire Re: Automatically creating a... 03-10-2013, 11:08 PM
KK1234 Re: Automatically creating a... 03-13-2013, 06:05 AM
JBeaucaire Re: Automatically creating a... 03-13-2013, 08:25 AM
KK1234 Re: Automatically creating a... 03-13-2013, 09:32 AM
JBeaucaire Re: Automatically creating a... 03-13-2013, 09:49 AM
KK1234 Re: Automatically creating a... 03-13-2013, 10:05 AM
JBeaucaire Re: Automatically creating a... 03-13-2013, 10:55 AM
KK1234 Re: Automatically creating a... 03-18-2013, 03:19 PM
JBeaucaire Re: Automatically creating a... 03-18-2013, 03:29 PM
KK1234 Re: Automatically creating a... 03-19-2013, 05:22 AM
KK1234 Re: Automatically creating a... 03-24-2013, 09:26 AM
  1. #1
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Unhappy Automatically creating a back copy in other location which is updated at all times

    Hi ,
    I am using this code to make an automatic copy of work book in other destinations.
    I am learning on how to write the code.
    My file name is ABCDE and it is at C:/TP/NN ( NN is the folder)
    Path where back up copy is to be saved is C:/TP/BK( BK is the name of the folder)
    I want the data on back copy saved every time the main copy is modified, however if some one tries to delete any information, then the back up copy remains as it is.
    How it can be possible???
    I have a general code, but dont know how to rewrite it.
    Please help...


    Sub MyBackup()
    ' Saves a renamed copy of this workbook in the nominated folder as a backup.
    ' Pre-requisite: PathExists Function (see below)
    
    Dim fname As String
    Dim Path As String
    Dim PathnName As String
    Dim Mydate as String
    
    On Error Resume Next
    MyDate = Format(Date, "yymmdd") & " "
    Path = "[Specify path for backup here, including final \]" 
    
    fname = MyDate & ThisWorkbook.Name
    PathnName = Path & fname
    
    If PathExists(Path) Then
        ThisWorkbook.SaveCopyAs PathnName
    Else
        Exit sub
    End If
    End Sub
    
    Public Function PathExists(pname) As Boolean
    ' Returns TRUE if the path exists
    ' Code source: http://www.j-walk.com/ss/excel/tips/tip54.htm
    Dim x As String
    
    On Error Resume Next
    x = GetAttr(pname) And 0
    If Err = 0 Then PathExists = True Else PathExists = False
    
    End Function
    Last edited by JBeaucaire; 03-09-2013 at 10:42 AM. Reason: Added code tags, as per forum rules. Don't forget!

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