password protect a worksheet
Amazing chart utilities from Jon Peltier
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: password protect a worksheet

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    83
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I want to make a spreadsheet available for say 30 days, then, after that time a messagebox appears notifying the user that the spreadsheet has expired ( and subsequently prevents them from opening it ) but then I still want to open it .. so can the messagebox then prompt for the same VBA password that protects all the code .. and if it is entered correctly .. opens the password as normal ?

    Thanks
    Bill

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the following:
    Code:
    Private Sub Workbook_Open()
    Dim StartDate As Date
    StartDate = "04/16/2002"
    If DateDiff("d", Now, StartDate) >= 30 Then PasswordCheck = InputBox("Password has expired, enter password")
    If PasswordCheck <> "password" Then
    Application.DisplayAlerts = False
    ThisWorkbook.Close
    End If
    End Sub
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    dont rely on Excel protection is aweful and stop advance user for about 3 1/2 seconds be for we rip it apart, but will keep out the non advanced user or about 5 seconds.

    just to say so not relying on this to much easy hacked...


    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  4. #4
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Jack is very right. To get around it all you have to do is disable macros.

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    CA
    Posts
    180
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default password protect a worksheet

      
    I am confused. It seems the code above closes the workbook with no message appearing.

    Am I doing something wrong?

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com