Results 1 to 12 of 12

Thread: Save a copy solution

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    VBAX Regular
    Joined
    Jun 2005
    Posts
    51
    Location
    I had similar problem recently. See thread http:\vbaexpress.com/forum/showthread.php?t=14614

    The following worked for me in the end...(change the location to your archive folder)


    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 
            Dim sFile 
            Dim location As String 
        Application.EnableEvents = False 
        location = "c:\log\staff authorisations archive\" 
        sFile = Replace(ThisWorkbook.Name, ".xls", " Backup ") & Format(Now, "yyyymmdd hh-mm-ss") 
        ThisWorkbook.SaveCopyAs location & sFile & ".xls" 
        Application.EnableEvents = True 
    End Sub
    Last edited by Aussiebear; 03-03-2025 at 03:33 AM.

Posting Permissions

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