+ Reply to Thread
Results 1 to 5 of 5

VBA to clear the clip board

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    VBA to clear the clip board

    We have a pretty large workbook with a bunch of code. I keep running into an error from time to time at the weirdest times. Sometimes you will just be copying and pasting into the same or other workbooks and for no reason you will get a error saying you can not complete the task because the clipboard is being used by another program. At that point all the code stops working. The only way to fix it is to close all excel sheets that are open and then reopen then they will work again.

    We work remotely and when I copy and paste remotely or a macro runs on a machine you are remotely working on ...I can see the clipboard of excel sheets on the computer I use to remote in with its clipboard has all the copy and paste events from the remote computer.

    I have tried all the versions of having a macro clear the clip board but they never actually clear it.

    I thought the macros were being interrupted and after the events were disabled they just are not getting re-enabled but I went thru and put things into place on error to reenable everything.

    I even tried having a macro button just run and re-enables the events, but that does not work.

    ex:
    Please Login or Register  to view this content.
    I would like to find a macro that will clear the clipboard as we go along automatically and a macro that would reenable the sheet to get it working without having to save & close all of them open and then reopen.

    I wish I could get the event to happen when I want but it is random and never happens on the same worksheet.

    Any thoughts or suggestions.

  2. #2
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,360

    Re: VBA to clear the clip board

    Please Login or Register  to view this content.
    If things don't change they stay the same

  3. #3
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: VBA to clear the clip board

    Should I place that in all the macros and where is the best placement for it?

  4. #4
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,360

    Re: VBA to clear the clip board

    Yes place it in the macro,

    I use it after a large paste operation OR I will use it at the end of the sub to make sure we empty the clipboard after code as it can get cluttered.

  5. #5
    Forum Contributor
    Join Date
    03-08-2018
    Location
    Denmark
    MS-Off Ver
    2016 for Windows
    Posts
    413

    Re: VBA to clear the clip board

    There is a difference between the windows clipboard and excel clipboard.


    Reads here: https://www.automateexcel.com/vba/clear-clipboard/

    Excel VBA Clear Clipboard
    Clearing the clipboard in Excel VBA only requires a single line of code:

    Please Login or Register  to view this content.

    vba clear clipboard

    However, this is different from the standard Windows clipboard. To clear the Windows clipboard you can use the EmptyClipboard Function. Copy and paste the code below into a code module and run Sub TestClipboardClear to clear the Windows clipboard.

    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] Macro to Clear win 10 64 bit clip board
    By JeffGrant in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-20-2021, 04:10 AM
  2. Clear the Clip Board
    By Jerry in Houston in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-23-2017, 05:55 PM
  3. How to clear clip board from vba
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2011, 08:35 AM
  4. Vba copy to clip board
    By eddbod in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2009, 12:14 PM
  5. HOW DO YOU PASTE FROM THE CLIP BOARD?
    By PARADISE1333 in forum Excel General
    Replies: 1
    Last Post: 01-14-2006, 11:00 AM
  6. Clear Clip Board Memory
    By James_Newton in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2005, 08:07 PM
  7. CLEAR CLIP BOARD
    By mike in forum Excel General
    Replies: 1
    Last Post: 02-10-2005, 11:06 AM

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