+ Reply to Thread
Results 1 to 5 of 5

Pasting Text at the Cursor Point in a Textbox

  1. #1
    Registered User
    Join Date
    06-14-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    3

    Pasting Text at the Cursor Point in a Textbox

    Hi everyone.

    I have been sieving through the forums for hours now and can't seem to get an answer that suits my needs.

    On a userform I have several textboxes and at some point the user may want to highlight a section of text from textbox1 (lets say) and copy and paste it into another textbox (this could be one of 20). The two issues I need solving are as follows:

    1. The text being pasted needs go in the textbox the user currently has the cursor in, and
    2. The text needs pasting at the cursor location within that textbox.

    I have already worked out how to copy the selected text to the clipboard. It is now just a matter of working out how to paste it from the clipboard to a specific location - this appears to be somewhat trickier.

    Also, I have considered adding a right-click option for the user but I'm not convinced by my users computing abilities so want to set the copy and paste up as two separate buttons.

    Thanks for any help in advance!

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Pasting Text at the Cursor Point in a Textbox

    gazzyp,

    Welcome to the forum!
    I believe what you're asking for is already default behavior. Just use ctrl+c to copy and ctrl+v to paste where desired. I just did a quick test userform and it worked just fine for me...
    If it is not working for you, can you attach a sample file that is experiencing the problem?
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    06-14-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Pasting Text at the Cursor Point in a Textbox

    Hi Tiger,

    Thanks for getting back so quickly.

    I probably wasn't clear enough. Yes I am aware of ctrl c and v however I want the user to be able to do copy and paste of the text they have highlighted using two buttons.

    I have attached an example of my problem.

    You will see that the two buttons, copy and paste on the the userform. I have already stolen code from another post that allows me to copy the highlighted text (lets say all the text from tb1 in my example). I then want the user to be able to paste the text at the cursor location in whichever text box they are currently writing in. In the example case, tb4.

    I hope this makes it a bit clearer.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-14-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Pasting Text at the Cursor Point in a Textbox

    My apologies. The sheet I attached isn't working. Here is a version that does.
    Attached Files Attached Files

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Pasting Text at the Cursor Point in a Textbox

    Uhh... Why would you want buttons? That seems unnecessary to me... It should be easy enough to educate users on ctrl+c and ctrl+v. No reason to reinvent the wheel.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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