locked
VBA 2010 Clear Office Clipboard RRS feed

  • Question

  • Does anyone know the code to clear the office clipboard in vba? This is applicable for Excel or Access.

    In VBA 2007 it was: Application.CutCopyMode = False

    That is no longer an option in 2010

    Thank you!!!!

     

    Tuesday, December 14, 2010 5:16 PM

Answers

  • Hello,

    Thank you for your responce. Application.CutCopyMode = False works sometimes. It does not seem reliable We create images from charts in Excel and paste them into PowerPoint.

    But we have found a work around solution.

    Thank you again for your help.


    Lana Mitchell
    • Proposed as answer by Bruce Song Tuesday, January 4, 2011 2:07 AM
    • Marked as answer by Bruce Song Tuesday, January 4, 2011 2:09 AM
    Tuesday, January 4, 2011 12:28 AM

All replies

  • You cannot clear the *Office* Clipboard with VBA in Office 2010 (except maybe with Sendkeys) - nor could you in Office 2007 - you have to go back to Ofice 2000 for that capability.
     

    Enjoy,
    Tony
    www.WordArticles.com
    Tuesday, December 14, 2010 5:52 PM
  • You cannot clear the *Office* Clipboard with VBA in Office 2010 (except maybe with Sendkeys) - nor could you in Office 2007 - you have to go back to Ofice 2000 for that capability.
     

    Enjoy,
    Tony
    www.WordArticles.com

    Thank you for your response. I'm trying to see if I can figure out a way using SendKeys. There must be some way of doing it. Our company generates reports in PowerPoint from an Excel file and I'm working on the automation. I need to figure out a way to clear the clipboard so that the module doesn't stall when the clipboard gets full.
    Lana Mitchell
    Wednesday, December 15, 2010 2:07 PM
  • What problems are you encountering? What do you mean by 'stall'?
     
    FWIW, you shouldn't normally use the clipboard in VBA - that is hijacking something that belongs to the user. I do accept, though, that there are some things that can't really be done any other way.
     

    Enjoy,
    Tony
    www.WordArticles.com
    • Proposed as answer by Bruce Song Wednesday, December 22, 2010 6:44 AM
    • Marked as answer by Bruce Song Wednesday, December 29, 2010 12:28 PM
    • Unmarked as answer by Bruce Song Tuesday, January 4, 2011 2:07 AM
    Wednesday, December 15, 2010 4:25 PM
  • Hi LanaMitchell,

    Thank you for posting and we are glad to help with you.

    Have you got some solution to resolve your issue yet?

    You said:

    In VBA 2007 it was: Application.CutCopyMode = False

    That is no longer an option in 2010

    However, it seems that Application.CutCopyMode = False can be used in Excel2010, and belowing is my code:

    Private Sub CommandButton1_Click()
    Range("A1").Copy
    Range("A2").PasteSpecial (xlPasteValues)
    Application.CutCopyMode = False
    End Sub

    I hope it can help you and feel free to follow up if you still have some concern on the post.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Wednesday, December 29, 2010 12:28 PM
    • Unmarked as answer by Bruce Song Tuesday, January 4, 2011 2:07 AM
    Wednesday, December 22, 2010 7:02 AM
  • Hello,

    Thank you for your responce. Application.CutCopyMode = False works sometimes. It does not seem reliable We create images from charts in Excel and paste them into PowerPoint.

    But we have found a work around solution.

    Thank you again for your help.


    Lana Mitchell
    • Proposed as answer by Bruce Song Tuesday, January 4, 2011 2:07 AM
    • Marked as answer by Bruce Song Tuesday, January 4, 2011 2:09 AM
    Tuesday, January 4, 2011 12:28 AM
  • Hello LanaMitchell,

    Thank you for your response. I’m glad to hear that you got it workingIf you can share your solutions & experience here, it will be very beneficial for other community members who have similar questions.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 4, 2011 2:09 AM
  • Hello Bruce,

    Our solution was not a code based one. We are having our users copy the program and report template to their C: drives and run it from there. Therefore when the program stops due to a copy/paste error when the clipboard is full, the template is not unable to open for other users in the case where someone running the program does not check up on it or close it in time.

    The template is a powerpoint template so there is no way to specify multiple access.

    It's an imperfect system.

    Thanks,

     


    Lana Mitchell
    Thursday, January 6, 2011 10:00 PM
  • Hello,

    I forgot to mention one other thing, the clear clipboard requirement was for Access 2010 VBA not Excel. Application.CutCopyMode didn't exist for Acess 2007.

    Thanks,

     

    Lana Mitchell


    Lana Mitchell
    Monday, January 17, 2011 7:03 PM
  • Hi Bruce

    I had a similar problem to LanaMitchell.  I wrote some VBA in Excel 2010 to copy each row from one sheet to another sheet between different workbooks.  I was opening a number of workbooks sequentially to copy from them.  Every time I closed the source workbook I got the message:

    "There is a large amount of information on the Clipboard.  Do you want to be able to paste this information into another program later?". 

    To stop this message being displayed I inserted the Application.CutCopyMode = False code directly before closing the workbook: 

     Application.CutCopyMode = False
    
     wbkTemp.Close (False)

    It doesn't clear the clipboard but it does resolve the issue I had.

    Wednesday, July 13, 2011 1:43 PM
  • I didn't tested in 2010 but maybe works...

    Reference FM20.dll at windows\system32 and

        Dim DataObj As New MSForms.DataObject
        DataObj.Clear

    Sunday, March 23, 2014 6:54 PM