Home All Groups Group Topic Archive Search About

Excel ClipBoard to VB.NET

Author
6 Apr 2006 1:04 PM
Pieter
Hi,

Is there an 'exact' way to get data in a VB.NET 2005 application that was
put on the clipboard in Excel?

For instance:

When I have an Excel-sheet with 4 values (2 columns, 2 rows)
      A1 B1
      A2 B2

I copy it to the clipboard, and get this in my VB.NET application:

?my.Computer.Clipboard.GetText
"t1 t2
t3 t4
"

?my.Computer.Clipboard.GetText.Split(vblf)
{Length=3}
    (0): "t1 t2
"
    (1): "t3 t4
"
    (2): ""

?my.Computer.Clipboard.GetText.Split(vbtab)
{Length=3}
    (0): "t1"
    (1): "t2
t3"
    (2): "t4
"

So basicly: I have to cut them in rows by splitting on vbCr, and than cut
every line in columnc by splitting on vbTab...

Is this the only way? Or does a 'nicer' way exists?

Thanks,

Pieter

AddThis Social Bookmark Button