+ Reply to Thread
Results 1 to 6 of 6

Excel Workbook Time Lock

Hybrid View

sunnyjee Excel Workbook Time Lock 11-02-2020, 11:33 PM
maniacb Re: Excel Workbook Time Lock 11-03-2020, 04:32 PM
sunnyjee Re: Excel Workbook Time Lock 11-04-2020, 12:31 AM
Croweater Re: Excel Workbook Time Lock 11-04-2020, 01:38 AM
Sintek Re: Excel Workbook Time Lock 11-04-2020, 02:46 AM
hrlngrv Re: Excel Workbook Time Lock 11-04-2020, 03:19 AM
  1. #1
    Registered User
    Join Date
    03-11-2012
    Location
    Abu Dhabi UAE
    MS-Off Ver
    365
    Posts
    13

    Excel Workbook Time Lock

    Hi Friends, I want help to lock my excel workbook after a specific future date so that nobody can edit and copy only can read and required password in order to restore or unlock the workbook. Can somebody help for that?

    Regards,

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Excel Workbook Time Lock

    You can create an open workbook event in the workbook module to protect the active sheet if a date is met, like this:
    Option Explicit
    
    Private Sub Workbook_Open()
    Dim FutureLockDate As Date
    
    FutureLockDate = #11/3/2020#
    
        If Date >= FutureLockDate Then
            ThisWorkbook.Sheets("Sheet1").Protect Password:="123"
        End If
    End Sub

    To protect the workbook:
    Option Explicit
    
    Private Sub Workbook_Open()
    Dim FutureLockDate As Date
    
    FutureLockDate = #11/3/2020#
    
        If Date >= FutureLockDate Then
            ThisWorkbook.Protect Password:="123"
        End If
    End Sub

  3. #3
    Registered User
    Join Date
    03-11-2012
    Location
    Abu Dhabi UAE
    MS-Off Ver
    365
    Posts
    13

    Re: Excel Workbook Time Lock

    Hi its not working and also in this way i think workbook can be unprotected if somebody will disable the macro??

  4. #4
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Excel Workbook Time Lock

    You can make sheets invisible (apart from maybe a 'warning' sheet) with something like this...
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.ScreenUpdating = False
    Sheets("Warning").Visible = xlSheetVisible
    
    ' hide all sheet but Warning sheet
    For Each sh In Worksheets
    If Not sh.Name = "Warning" Then sh.Visible = xlVeryHidden
    Next sh
    End Sub
    You can then make them visible in a workbook open event. This will ensure macros are enabled.
    Private Sub Workbook_Open()
    For Each sh In Worksheets
    sh.Visible = xlSheetVisible
    Next sh
    ' hide the warning sheet
    Sheets("Warning").Visible = xlVeryHidden
    End Sub
    BTW, if you tell me that "it's not working" without any 'added value' whatsoever, you will ensure you get no more help from me.
    Last edited by Croweater; 11-04-2020 at 01:44 AM.

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Excel Workbook Time Lock

    Hi its not working and also in this way i think workbook can be unprotected if somebody will disable the macro??
    With available Excel protection methods, there is no full proof method of protecting Excel...
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  6. #6
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Excel Workbook Time Lock

    You can use VBA and event handlers to do this so that casual users wouldn't be able to use the workbook. However, there's no way to protect or lock any Excel workbook a user can open if that user is intent on breaking all the internal protections you try to impose. Only passwords for opening Excel workbooks are robust. All internal passwords and protections are weak and easily cracked by anyone with a web browser, a hexadecimal editor and the ability to follow instructions.

+ 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. How to lock comments in Excel workbook?
    By kingston_123 in forum Excel General
    Replies: 4
    Last Post: 07-06-2020, 11:42 AM
  2. how to time-lock a excel document
    By jacksonwoo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-26-2019, 10:13 AM
  3. [SOLVED] Password lock for Worksheet in a excel workbook
    By z3162238 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-16-2014, 09:54 AM
  4. Track Computer Lock and Unlock time in excel
    By Subir Basak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2014, 03:07 AM
  5. Track Computer Lock and Unlock time in excel
    By Subir Basak in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 06-26-2014, 08:06 PM
  6. Time lock an entire workbook - even unprotected cells
    By AlexanderTheAverage in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2012, 01:57 PM
  7. How do I set up a time lock in Excel?
    By Justin in forum Excel General
    Replies: 2
    Last Post: 03-20-2006, 09:15 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