+ Reply to Thread
Results 1 to 2 of 2

can you make a password active after a certain date?

  1. #1
    Registered User
    Join Date
    06-14-2005
    Posts
    1

    Question can you make a password active after a certain date?

    I dont know if this is at all possible??

    I wanted to enable a spreadsheet to be password protected after a certain timeframe has passed - or on a specified date.

    No idea where to start so any help or suggestions would be appreciated

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning RCollinge

    This isn't possible using any native Excel commands but we could write our own using the Before_Save event procedure. The code below will happily let a workbook save without a password, however, after 1st Jan next year a password (of "password") will be added - with no warning - to the file when it is saved. However, there is a big but here. The user must say "OK" to run macros when the file is opened - if the user says no to the macro question the code will do nothing. And don't forget that this code (as it uses event procedures) needs to go into the ThisWorkbook pane of the VBE.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Application.DisplayAlerts = False
    mydate = Now()
    mydate2 = DateValue("January 1, 2006")
    ActiveWorkbook.Save
    If mydate > mydate2 Then
    ActiveWorkbook.SaveAs Filename:="C:\Book4.xls", Password:="password"
    End If
    Application.DisplayAlerts = False
    End Sub

    HTH

    DominicB

+ Reply to Thread

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