+ Reply to Thread
Results 1 to 5 of 5

excel vba - creating password backup workbook in Save event

  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    excel vba - creating password backup workbook in Save event

    ---
    Below is code to save a backup copy to a folder. Every time I try and code in a password for a copy, either both the copy and the original workbook require the password to open, or I have the syntax incorrect. I don't want a password for the original wb, just the copy wb.

    How can I rewrite this so I could keep this within the BeforeSave event?
    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,523

    Re: excel vba - creating password backup workbook in Save event

    SaveCopyAs doesn’t have the option to provide a password. You'd need to use SaveAs. If you want two copies, use Save and then SaveAs.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: excel vba - creating password backup workbook in Save event

    I've tried that but if I Save, then SaveAs, the SaveAs copy is the active workbook. How can I close the copy without having to close the workbook?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,523

    Re: excel vba - creating password backup workbook in Save event

    Ok, maybe SaveAs backup file, then SaveAs original file (with Application.DisplayAlerts = False)

  5. #5
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: excel vba - creating password backup workbook in Save event

    Please Login or Register  to view this content.
    Excel doesn't like that apparently. Crashes the program - I imagine it has to do with setting the first SaveAs with password.

    However, what the routine produces requires a password for both backup and original - obviously because the first SaveAs tags the wb with a password, so the next SaveAs is saving the document that coded the password. I sure wish SaveAsCopy would have the capability to assign a password.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save a backup with date/time when particular Excel Author opens workbook
    By jwats in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2016, 03:38 PM
  2. Save as without creating a backup file
    By chengafni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2015, 12:11 PM
  3. Save Active workbook, Add a password via a prompt and stop creating backups
    By dlast in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2013, 05:59 AM
  4. Creating macro to save a backup copy of the same file in a shared drive
    By Kiran9 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-29-2011, 07:15 AM
  5. Save backup of workbook before close
    By jeffreybrown in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2009, 12:03 AM
  6. Creating Backup file! (Not Save-as)
    By Rick_Stanich in forum Excel General
    Replies: 1
    Last Post: 11-24-2009, 06:34 PM
  7. [SOLVED] Save a BackUp of Workbook
    By Rocky McKinley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2005, 10:05 PM

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