Results 1 to 9 of 9

Thread: Lock TextBox From Selecting Or Copying Text But Allow Scroll

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    10
    Rep Power
    0

    Lock TextBox From Selecting Or Copying Text But Allow Scroll

    Hi,

    I've require solution to above subject line with and without VBA while working on TextBox inserted through developer.

    Thanks
    R_Know

    Lock Text for copy and allowed to Scroll.xlsm

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Can you please elaborate on what exactly are you hoping to do?
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Junior Member
    Join Date
    Jun 2012
    Posts
    10
    Rep Power
    0
    attached file, having textbox which having text, it has to be read with scroll function in that textbox.
    But user does not allowed to copy text from text box and does not allowed to delete TextBox.

  4. #4
    Junior Member
    Join Date
    Jun 2012
    Posts
    10
    Rep Power
    0
    Quote Originally Posted by r_know View Post
    attached file, having textbox which having text, it has to be read with scroll function in that textbox.
    But user does not allowed to copy text from text box and does not allowed to delete TextBox.








    ANY SOLUTION PLS

  5. #5
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Rudimentary. But adding this code seems to be working

    Code:
    Private Sub TextBox1_GotFocus()
    
    
        ActiveCell.Select
        
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  6. #6
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Put this code in Sheet1 module.

    Code:
    Option Explicit
    Dim ClipBoard As MSForms.DataObject
    
    Private Sub TextBox1_GotFocus()
    
        TextBox1.WordWrap = False
        TextBox1.WordWrap = True
    
    End Sub
    
    Private Sub TextBox1_LostFocus()
        
        Set ClipBoard = New MSForms.DataObject
        
    'hope one of these will work :)
        Application.CutCopyMode = False
        ClipBoard.Clear
        ClipBoard.SetText ""
        ClipBoard.PutInClipboard
        
    End Sub
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  7. #7
    Junior Member
    Join Date
    Jun 2012
    Posts
    10
    Rep Power
    0
    Thanks Admin
    But It is allowing to copy from textbox, good thing only it wrap it...
    Last edited by r_know; 08-17-2016 at 03:33 AM.

  8. #8
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Can you check the code I posted. Like I said, it is rudimentary, but seems to be working.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  9. #9
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Please check whether it allows to paste.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Replies: 14
    Last Post: 06-03-2014, 10:29 PM
  2. Replies: 4
    Last Post: 11-15-2013, 03:42 PM
  3. Replies: 10
    Last Post: 10-17-2013, 07:36 PM
  4. Selecting workbook to run macro
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 2
    Last Post: 08-24-2012, 08:21 PM
  5. Scroll Lock and Unlock using VBA
    By LalitPandey87 in forum Excel Help
    Replies: 2
    Last Post: 11-08-2011, 08:59 AM

Posting Permissions

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