Excel ClipBoard to VB.NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pieter

    Excel ClipBoard to VB.NET

    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.Cl ipboard.GetText
    "t1 t2
    t3 t4
    "

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

    ?my.Computer.Cl ipboard.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



Working...