Size issue with pasting large text fields using a VBA macro

I have run into a size issue with large text fields (e.g. over 1024). I am trying to get text fields of length...

2992 from one worksheet cell to another using a VBA macro. The problem appears to be that VBA uses an internal paste buffer that is smaller than the Windows paste buffer. Is this true? If so, can I increase it? If not, is there a workaround?

The offending line of code is 'Sheets(tab_name).Cells(74, 2).Value = Sheets(sNewSheet).Cells(i + 206, 1).Value.'

While I've never run into the paste limit, I could see how it happens. What you're going to have to do is manually call the clipboard C API functions and do the copy and paste yourself. Charles Petzold's seminal "Programming Windows" shows how to do it in C. Additionally, there are plenty of code samples around the Internet on how to use the clipboard directly from VB.

This was first published in August 2002

Dig Deeper on Windows Operating System Management



Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:









  • VDI assessment guide

    Wait! Don't implement VDI technology until you know your goals and needs. A VDI assessment should consider the benefits of a VDI ...

  • Guide to calculating ROI from VDI

    Calculating ROI from VDI requires a solid VDI cost analysis. Consider ROI calculation models, storage costs and more to determine...

  • Keep the cost of VDI storage under control

    Layering, persona management tools and flash arrays help keep virtual desktop users happy and VDI storage costs down.