Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    La Jolla, CA
    Posts
    1,470
    Thanks
    30
    Thanked 62 Times in 58 Posts

    Restrict functionality after a specific date

    Is there a way to stop an Excel workbook from being used or functioning at all after a specific date (without a password or some other means to turn use or functionality back on)?

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    K,

    For VBA functionality you could place a date check in the Auto_Open() macro that sets a global variable to T/F and then check the variable. However this is not to hard to subvert. Another option would be to create a DateCheck function that each routing would call via IF Not DateCheck() then Exit Sub.

    As for the worksheet functionality {formulas} depending on how deep you wanted to get into things you could use the function created above as part of the formulas, etc.

    None of this is very elegant but the best I could come up with on the spot. HTH

    BTW: You could also check the logged on userid in the function to allow access after the date.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    La Jolla, CA
    Posts
    1,470
    Thanks
    30
    Thanked 62 Times in 58 Posts
    Thanks for your thoughts...

    I don't know enough VBA to write the code to check things. The workbook doesn't have any VB. What I want to do it not allow use of the workbook after a given date unless a password is provided. Essentially, he application has expired at a specific date.

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    K,

    You'd place the following code in a Module of the desired workbook.
    Code:
    Option Explicit
    
    Sub Auto_Open()
    
       Dim zPassword As String
    
       If Date > DateValue("05/17/2013") Then
         zPassword = InputBox("Please Enter Password for Access", "Application Expired")
         If Not zPassword = "Testing" Then Application.Quit
       End If
       
    End Sub
    Sample file attached: VBA - Excel - AutoOpen Date Test.xls HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    La Jolla, CA
    Posts
    1,470
    Thanks
    30
    Thanked 62 Times in 58 Posts
    AH HA. Sounds great. Thanks.

Posting Permissions

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