+ Reply to Thread
Results 1 to 10 of 10

Paste Clipboard into Userform Textbox

  1. #1
    Registered User
    Join Date
    09-25-2016
    Location
    Florida
    MS-Off Ver
    365
    Posts
    51

    Paste Clipboard into Userform Textbox

    I created a command button on my userform to "paste" the clipboard to a text box. Then I hit a Search button to look up the part number and fills all the other text boxes on the form. The paste button works fine but the "search" button acts as if the text box is blank. Yes, ctrl+v works fine but I want a button. Below is my code and of course it's too simple of a solution to work!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Paste Clipboard into Userform Textbox

    See attached form - first use copy from the RH dropdown - then launch the form - press transfer from 'clipboard' then 'transfer to sheet'
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    09-25-2016
    Location
    Florida
    MS-Off Ver
    365
    Posts
    51

    Re: Paste Clipboard into Userform Textbox

    Thank you for the suggestion. Maybe I'm missing how to use what you provided but I'm not wanting to paste the text on the clipboard into a cell of a sheet. The textbox on the Userform is where I enter a sku....such as 6308-2pk and then I press the "Search" button and it will fill the rest of the Userforms text boxes, based on the pasted text/sku, with data from my inventory sheet. There are 40 different textboxes on the Userform that are filled based on the pasted sku. I have over 1,000 skus. To further explain....The backend of my business is ran on a website and on the website I have to copy a sku by using ctrl+c and then paste into the sku box of the Userform using ctrl+v. Then I press the "Search" button to look up the sku's particulars such as cost, margins, fees and many other bits of data about the sku. I'd rather just press a "Paste" button.

    The Userform works fine using ctrl+v but I want it simpler, for me, by just pushing a button to paste and then pressing the "Search" button as usual. As mentioned, if I use the code I provided initially or the code you provided in your sample workbook then my "Search" button seems to only see it as a "blank" box even though the text pasted with the new button is visible. I don't even get my error message "P/N doesn't exist".

    I do appreciate the help.

    Thanks,
    Andy

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Paste Clipboard into Userform Textbox

    Simplest solution - see big yellow banner - upload your workbook with a few rows of fictitious data.
    That way we are all singing of the same hymn sheet and a solution will most likely be given.

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Paste Clipboard into Userform Textbox

    I have attached it to one of my previous submissions.
    To trial the app - copy a part number from the table - launch the form - click the paste button - click the find button
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-25-2016
    Location
    Florida
    MS-Off Ver
    365
    Posts
    51

    Re: Paste Clipboard into Userform Textbox

    Your latest file is exactly what I need it to do. I used your code from the "Paste Part #" button added to my "Paste" button and changed my search box name accordingly. Like I've already been able to do, it WILL paste the clipboard value into the search text box, but when I hit the "Search" button, nothing happens.

    To go further....using this part number "6308-2pk" and pasting it using the Paste button then it will paste in the search box BUT nothing populates when the "Search" button is pressed....it's as if the search box is blank. However, if I backspace over the "k" and retype the "k" then it recognizes the whole part number and populates the other textboxes accordingly when the "Search" button is pressed.

    I have searched and searched to resolve this issue and this is as close as I can get. I think I understand that we're changing the clipboard to a DataObject so it can see the clipboard as "text" rather than an image?

    Please Login or Register  to view this content.
    What in the world am I missing?

    Andy

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Paste Clipboard into Userform Textbox

    without your actual file it could take ages of guessing, it is quite possible that it is simply syntax.
    without a file to test we are wasting each others time speculating.

  8. #8
    Registered User
    Join Date
    09-25-2016
    Location
    Florida
    MS-Off Ver
    365
    Posts
    51

    Re: Paste Clipboard into Userform Textbox

    I've tried to reduce the file by copying the applicable sheet to a new workbook but it's still 5.39mb. I deleted all the 900+ sku's and only have a 4 test sku's and deleted all formatting all the way down and to the right. 5.39mb is the smallest I could get it for some reason. I'll work on it more tomorrow to reduce it and hopefully get something useful for you to work on.

    I appreciate the effort and understand on needing the file.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Paste Clipboard into Userform Textbox

    @ tora

    Short and sweet.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 10-19-2021 at 02:47 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  10. #10
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Paste Clipboard into Userform Textbox

    @bakerman2, but does it work for the O.P.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Creating a macro to copy/paste the value from userform textbox to another
    By cjlindsay22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2021, 06:57 PM
  2. Custom menu to copy/paste from textbox to clipboard
    By DMA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2020, 08:38 AM
  3. R Click paste/copy in an textbox userform
    By IceSnakeR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2018, 07:54 AM
  4. [SOLVED] Capture paste into textbox on userform
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2015, 10:13 AM
  5. [SOLVED] Textbox Userform To Prevent A Certain String To Be Paste
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2014, 06:39 PM
  6. [SOLVED] Help with Userform textbox value, vlookup, copy to clipboard
    By etuckram in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 07-04-2012, 09:25 PM
  7. Copy/Paste from worksheet to textbox in userform
    By jarrods in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2009, 05:52 PM

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