+ Reply to Thread
Results 1 to 4 of 4

How to deactivate protection on text box

Hybrid View

  1. #1
    Registered User
    Join Date
    05-06-2004
    Posts
    5

    How to deactivate protection on text box

    Hi,
    I have a worksheet to be shared with other memeber of my company. There is information on the sheet that needs to be protected. I also have a text box on the sheet where individuals can put in comments. There is a text box and 2 commnad buttons (Mangers comments and Save). In order for a user to add comments they must press the managers command button and type in a p/w. Which works until I protect the worksheet. Once I protect the work sheet and try to access the Managers tab I get the following error message 'RUN TIME ERROR '1004' UNABLE TO SET LOCKED PROPERTY OF THE OLEOBHECT CLASS'
    Is there anyway to protect the worksheet and still be able to insert comments into the text box. A copy of my macro is below.

    Thank you
    ________
    Private Sub CommandButton3_Click()
    TextBox1.Enabled = False
    TextBox1.Locked = True


    End Sub

    Private Sub CommandButton2_Click()
    Dim Message, Title, Default, MyValue
    Message = "PLEASE ENTER A VALID PASSWORD IN THE FIELD BELOW." ' Set prompt.
    Title = "WARNING" ' Set title.
    Default = "ENTER VALID PASSWORD HERE" ' Set default.
    ' Display message, title, and default value.
    MyValue = InputBox(Message, Title, Default)
    If MyValue = "EPR05" Then
    TextBox1.Enabled = True
    TextBox1.Locked = False
    Else
    TextBox1.Enabled = False
    TextBox1.Locked = True
    End If

    End Sub

    Private Sub TextBox1_change()

    End Sub

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    I think you need to unprotect the sheet in your macro *before* you set the properties of the text box. If the password prompt fails, reprotect the sheet and then exit macro.

    HTH
    Last edited by swatsp0p; 04-25-2005 at 02:36 PM.
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Registered User
    Join Date
    09-16-2004
    Location
    Virginia
    Posts
    46
    Quote Originally Posted by swatsp0p
    I think you need to unprotect the sheet in your macro *before* you set the properties of the text box. If the password prompt fails, reprotect the sheet and then exit macro.

    HTH
    That was my second choice!
    Tom Stock
    Office version: MSO 2002 SP3
    OS: Windows XP Pro
    Hardware: IBM Thinkpad T41

  4. #4
    Registered User
    Join Date
    09-16-2004
    Location
    Virginia
    Posts
    46
    When you protect your workbook, instead of using the default protection, select "Edit Objects" in the list of items you'll allow the users to do... see if that helps.

+ 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