VB CAD Tips

www.vbcad.com

Windows Clipboard & Text Boxes
 
Working with the Windows Clipboard

Copying and Pasting data to and from the Windows Clipboard is one of the great benefits of the Windows Operating System.  Knowing how to copy data to the Windows Clipboard using VBA comes in handy from time to time.

Situation 1:
I have a text box on a VBA form.  How can I copy the contents of the Text Box to the Windows Clipboard?

    TextBox1.SelStart = 0
    TextBox1.SelLength = Len(TextBox1.Text)
    TextBox1.Copy

Situation 2:
I have a text box on a VBA form.  How can I programatically paste the text from the Windows Clipboard to the Text Box?

    TextBox1.Text = ""
    TextBox1.Paste

Good luck and happy programming.


Back to Tips ©2000 by VB CAD  All rights reserved.         www.vbcad.com