+ Reply to Thread
Results 1 to 6 of 6

Copy text (form textbox) to clipboard - symbols

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Question Copy text (form textbox) to clipboard - symbols

    Hi everyone,

    So, simple thing: copying text from a textbox to clipboard using VBA. This has been working nicely but I've moved to a Win 10 64-bit & Office 365 ProPlus 32-bit (company laptop) and I'm in hell now!

    Every time I copy something I now get two damn symbols (like this ￿￿, or question marks if pasted to ms word).
    I've searched and as far as I understand there is a workaround using API... but I look at that and it's like quantum physics to me!

    This is the code I'm using (users press a "copy" button):
    Please Login or Register  to view this content.
    I look at a code using API (like this one https://stackoverflow.com/questions/...ndows-10-issue and I can't figure out where or how I tell this thing to get my text from the textbox called "TextForm".

    Can someone please enlighten me?
    Thank you.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy text (form textbox) to clipboard - symbols

    I can't test this with your version of Office, but give it a shot.


    Paste this in a standard code module e.g.; Module1

    Please Login or Register  to view this content.

    Use this to copy your textbox text to the clipboard.

    Please Login or Register  to view this content.

    This VBA Method would paste from the clipboard to a textbox.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Copy text (form textbox) to clipboard - symbols

    Hi no_Fate,

    Your code uses 'Early Binding'. Before you go to Alpha's API solution, try the equivalent of your code using 'Late Binding':
    Please Login or Register  to view this content.
    For a discussion (and examples of) 'Early Binding' vs. 'Late Binding' see https://peltiertech.com/Excel/EarlyLateBinding.html

    I prefer 'Late Binding' because it does not require a 'Library Reference'. One of the disadvantages of 'Late Binding' is that 'Intellisense' DOES NOT work.

    For more information about 'Intellisense' see:
    https://colinlegg.wordpress.com/2012...isense-part-1/
    https://colinlegg.wordpress.com/2012...isense-part-2/

    Lewis

  4. #4
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: Copy text (form textbox) to clipboard - symbols

    Good afternoon,

    Thank you Guys! @LJMetzger, because it was smaller, I've tried you method but unfortunately with the same result. Maybe I was doing something wrong.

    @AlphaFrog, that is working perfectly, thank you!

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Copy text (form textbox) to clipboard - symbols

    Quote Originally Posted by no_Fate View Post
    Maybe I was doing something wrong.
    FYI, no you weren't. The issue is a bug with the DataObject, so changing the binding context would not help in this case. I believe that the issue only occurs when you have something selected in a Windows Explorer window and you are using Windows 8 or later, though I don't know why.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: Copy text (form textbox) to clipboard - symbols

    Quote Originally Posted by xlnitwit View Post
    FYI, no you weren't. The issue is a bug with the DataObject, so changing the binding context would not help in this case. I believe that the issue only occurs when you have something selected in a Windows Explorer window and you are using Windows 8 or later, though I don't know why.
    Wow... that would explain why "sometimes" it worked (which was driving me nuts, by the way). I've never noticed that pattern. What a weird bug!

    Thank you xlnitwit.

+ 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. How to put the text value of a textbox and formula of a cell in clipboard
    By king05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2017, 07:06 AM
  2. Replies: 6
    Last Post: 04-21-2016, 02:15 PM
  3. VBA code to copy user form textbox content to clipboard
    By Sendilo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-17-2015, 10:19 PM
  4. [SOLVED] vba: copy value of textbox to another textbox in another form
    By saikong051 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2014, 04:05 PM
  5. copy only visible text boxes to clipboard from user form
    By brewsi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2014, 09:36 PM
  6. VBA - Macro Code to copy textbox text to another worksheet textbox
    By nitram lowm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-05-2013, 08:39 AM
  7. [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

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