+ Reply to Thread
Results 1 to 8 of 8

Copy to Clipboard not working

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Copy to Clipboard not working

    Okay, I've got an annoyance going on. Last week I noticed on macro I had, that copies items to the clipboard, when I pasted the result, it was only question marks. I shrugged that off and kept going, then promptly forgot.

    This morning it happened again with a different macro, so I seem to have the same issue with multiple macros.

    I've posted one example that is now putting question marks on my clipboard. Note that this macro is NOT THE PROBLEM, it's an EXAMPLE of the problem.

    My PC was recently reimaged, but I saved all my configurations and restored them, so almost everything so far seems to be working right, with this exception. The macro below requires MS Forms 2.0 object library, which IS referenced. The code exists in an add-in along with a lot of other stuff I use frequently, and everything else in the add-in seems to be working right, unless it copies to the clipboard.

    Any help would be greatly appreciated.

    Please Login or Register  to view this content.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Copy to Clipboard not working

    Sounds like maybe another copy happened that put data in the clicpboard in a different format?

    I am not sure what the character replacement thing was about. This does not have a problem with double quotes. B2 has the delta symbol in it. That was not an issue.
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Re: Copy to Clipboard not working

    Kenneth,
    I found out there's a Microsoft bug that's causing this. See this article: https://www.thespreadsheetguru.com/b...-the-clipboard
    I found one workaround; if I close all my Explorer windows, the code works fine. My next step will be to figure out hot to plumb the code at the link above into my various macros that copy to the clipboard.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Copy to Clipboard not working

    You should use the API calls to put text on the clipboard - it's a lot safer these days. You can put that code into a generic routine and just call it wherever you need it.
    Rory

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Copy to Clipboard not working

    I tried that API code, added to it, and some others. It was fine with ascii text but translated the delta symbol character in the formula string concatenation to ?. The problem is in the StrConv() I guess.

    I attached the file if you want to try it. The two API modules have some name collisions that cause ambiguous compile error. Just change name in one for testing purposes.

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Re: Copy to Clipboard not working

    Kenneth,
    I'm so sorry I left you hanging! I got pulled away, and promptly forgot this post, and then got fed up today because I keep having to close Explorer to use my macros. Grrr!

    Anyway, I'm looking at your code, and trying to understand it before I attempt to use it. You're using a convention I'm not familiar with, the # sign in front of your "If" statements.

    In the "MSForms" module, I fooled around a bit with the "Test_PutGetClipboard", trying to put my selection on the clipboard, rather than a hardcoded range. But "Selection.PutInClipboard" gives me an "Object doesn't support this property or method" error. "PutInClipboard (Selection.Value)" works, but only if I select just one cell. I have multiple macros that act on my selection, for instance "Copy Sum", which adds up my selection and puts the total on my clipboard, and another which copies everything I've selected to the clipboard and allows me to add a comma, dash, etc, between each character. There are others. For all of these, my current workaround is to close Explorer. Your PutinClipboard function appears to work, but how do we adapt it to a multi-range selection?

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Re: Copy to Clipboard not working

    Ignore my last post, still trying to understand.

    Am I wrong, or is your "PutInClipboard" function operating without having the API calls?

    Also, what is the difference between API, API2, and API3?

    Finally, if I have to use the API, do I put it at the top of each module that contains a macro that calls to the clipboard?

  8. #8
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,946

    Re: Copy to Clipboard not working

    figure it might help is I share some of the macros I'm having trouble with. There are others, but if I can solve these two I can solve all the rest. The macros work great when Explorer is closed.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ 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] VBA Copy Text to Clipboard has stopped working for me
    By slbrick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2019, 12:03 PM
  2. Copy is not working from clipboard
    By kiran527 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-21-2014, 08:11 AM
  3. clipboard not working
    By ammartino44 in forum Excel General
    Replies: 8
    Last Post: 04-29-2014, 03:34 PM
  4. [SOLVED] clipboard bypass not working
    By rossg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-24-2013, 06:01 PM
  5. Replies: 0
    Last Post: 06-27-2006, 06:40 PM
  6. [SOLVED] The clipboard althouth available is not working, why?
    By DIMITRIOS in forum Excel General
    Replies: 1
    Last Post: 06-02-2006, 07:39 AM
  7. [SOLVED] Paste Off Clipboard not working in 2003
    By Phippsy in forum Excel General
    Replies: 0
    Last Post: 03-20-2006, 01:30 PM

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