+ Reply to Thread
Results 1 to 3 of 3

VBA code to clear the Windows clipboard (better than application.cutcopymode = false)

  1. #1
    Registered User
    Join Date
    03-31-2020
    Location
    Missouri USA
    MS-Off Ver
    Office 365
    Posts
    3

    VBA code to clear the Windows clipboard (better than application.cutcopymode = false)

    I have a bunch of excel macros running back-office functions, and my users were accidentally copying out data that had been copied by VBA macros into other places (this is not good).
    I did some googled and found the typical "just use application.cutcopymode = false" answer all over the internet.

    Unfortunately this does not work, at least not in Windows 10 with Excel in office 365, so I had to be creative.

    I found a good starting place on this post: vbaexpress.com/kb/getarticle.php?kb_id=205
    This pointed me in the right direction, and after some small changes I found a way to clear my clipboard every time.

    Here is the code, with my comments:

    'THE CODE BELOW WAS CREATED AND PUT IN ALL TRACKERS TO STOP USERS FROM COPYING OUT CONFIDENTIAL DATA ACCIDENTALLY
    'IT WORKS BY CLEARING THE WINDOWS CLIPBOARD ENTIRELY

    Please Login or Register  to view this content.
    Last edited by alansidman; 07-09-2020 at 03:31 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: VBA code to clear the Windows clipboard (better than application.cutcopymode = false)

    Welcome to the forum.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Moreover - this sub forum is for asking questions and solving problems. Your post fits into scope of https://www.excelforum.com/tips-and-tutorials/
    Best Regards,

    Kaper

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: VBA code to clear the Windows clipboard (better than application.cutcopymode = false)

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html

    I have moved this post to Tips

    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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] After Range.Copy Paste and Application.CutCopyMode = False, Range still remains selected
    By badcluster in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-03-2020, 06:18 AM
  2. [SOLVED] ClipBoard Not Clearing: #Application.CutCopyMode=False#
    By TFiske in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-26-2018, 01:43 PM
  3. [SOLVED] Application.CutCopyMode=False
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-12-2017, 10:43 PM
  4. [SOLVED] Application.CutCopyMode
    By Chatters in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-10-2013, 04:40 PM
  5. DisplayFormulaBar = false seems to clear clipboard
    By oCoCarbon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2010, 07:05 AM
  6. [SOLVED] Can't paste when CutCopyMode is false even though clipboard is not
    By Paul628 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-05-2006, 02:45 PM
  7. Why is Application.CutCopyMode False?
    By Gary''s Student in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2006, 06:15 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