Help with Clipboard / moving data

J

Jim

Hello,

I have a word vba app (word 2003) that has to get a lot of data from the
clipboard, then parse it / display some of it.

The clipboard data is in a table format, copied from another application
that I can not access programmatically and get zero help from the IT dept
here. When I copy it onto the clipboard, all of the stuff that I want is
in the first table, but it also copies some text and possible a picture
file after the table (which I subsequently ignore when parsing the data)

Currently, I copy the data onto the clipboard from the other application,
then paste it into a new document, then the table/data is read into an
array and the sorting etc takes over and every thing is good. The orginal
paste is deleted


Is there a way to get the table data directly from the clipboard into a
multicolumn array? I have only the vaguest idea what a dataobject is in
connection to this and how this could be used with the clipboard object,
the word help file is pretty slim.

Thanks,


Jim
(e-mail address removed)
 
H

Helmut Weber

Hi Jim,
The clipboard data is in a table format, copied from another application
When I copy it onto the clipboard, all of the stuff that I want is
in the first table, but it also copies some text and possible a picture
file after the table (which I subsequently ignore when parsing the data)

Is there a way to get the table data directly from the clipboard into a
multicolumn array?

good question, but whithout knowing anything
about the other application, all is stabbing in the dark.

If I copy an Excel-sheet containing
some cells with text and some pictures
and assign it to a string, the pictures have gone.

Like that:

Sub Test5667()
Dim oDat As DataObject
Dim stmp As String
Set oDat = New DataObject
With oDat
.GetFromClipboard
stmp = .GetText
Selection.TypeText stmp
End With
End Sub

The Excel-cells are handed over as tab seperated text.
Empty rows are handed over as empty paragraphs.

IMHO, stmp could be converted into an array(x,y).

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
J

Jim

Hi Jim,


good question, but whithout knowing anything
about the other application, all is stabbing in the dark.

If I copy an Excel-sheet containing
some cells with text and some pictures
and assign it to a string, the pictures have gone.

Like that:

Sub Test5667()
Dim oDat As DataObject
Dim stmp As String
Set oDat = New DataObject
With oDat
.GetFromClipboard
stmp = .GetText
Selection.TypeText stmp
End With
End Sub

The Excel-cells are handed over as tab seperated text.
Empty rows are handed over as empty paragraphs.

IMHO, stmp could be converted into an array(x,y).

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP

Helmut ,

Thank you for your post.

The data is essentially a copy of information from a browswer that gives
a table with 6 columns and hundreds of rows, then some free text (that
can be ignored), possibly some pictures after this - also can be
ignored.

I think that I understand that the dataobject.gettext will give me only
the text that occurs before the next data type - but can that much fit
into one string (stmp). Once it is in this, then I can figure out how
to seperate it into an array - without typing it into the document
(which I will have to delete anyway). Your code is very helpful and I
will give it a try and re-post when done.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top