+ Reply to Thread
Results 1 to 3 of 3

password protecting sheet when workbook opens

  1. #1
    Registered User
    Join Date
    02-13-2006
    Posts
    3

    password protecting sheet when workbook opens

    I want a sheet in my workbook to be automatically protected when it opens. So, I put this into 'ThisWorkbook':

    Private Sub Workbook_Open()
    Password = "jack"
    ThisWorkbook.Sheets("invoice list").Protect Password:=Password
    End Sub

    Then I closed the workbook, reopened it, and the sheet was protected. However, I am now unable to unprotect it, as I keep getting told that I've got the wrong password!

    Firstly, does anyone know how I can unprotect this? Secondly, what did I do wrong? how can I get this to work?

    Thanks!!

  2. #2
    Registered User
    Join Date
    02-13-2006
    Posts
    3
    ok, I managed to unprotect it using this rather impressive tool:
    http://www.pcworld.com/downloads/fil...d,22990,00.asp

    But, I still don't understand why this happened. Any ideas?

  3. #3
    Registered User
    Join Date
    02-13-2006
    Posts
    3
    Problem solved!

    This seems to work, basically specifying the workbook. I don't understand the difference - I guess it's just one of those little mysteries....

    Private Sub Workbook_Open()
    Dim Password
    Password = "jack"
    Workbooks("INVOICESv2a.XLS").Sheets("invoice list").Protect Password:=Password
    End Sub

+ 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