+ Reply to Thread
Results 1 to 5 of 5

Clearing the clipboard

Hybrid View

  1. #1
    Registered User
    Join Date
    03-16-2004
    Location
    Visalia, Ca
    Posts
    13

    Clearing the clipboard

    Is there a way to clear the contents of the clipboard programatically?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Does this code work

    application.cutcopymode=false
    VBA Noov
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi VBA Noob

    The CutCopyMode=False just removes the "marching ants". As the clipboard is a Windows object you need API's to clear it effectively.

    Declare Function CloseClipboard Lib "user32" () As Long
    Declare Function EmptyClipboard Lib "user32" () As Long
    Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
    Sub ClearClipboard()
    OpenClipboard 0&
    EmptyClipboard
    CloseClipboard
    End Sub
    Calling the macro ClearClipboard should do just that.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Thanks DominicB for the correction

    VBA Noob

  5. #5
    Registered User
    Join Date
    03-16-2004
    Location
    Visalia, Ca
    Posts
    13
    Thank you as well Dominicb

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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