Finding and copying graphics from table cells

D

dedawson

I'm writing some code to parse a table and write the contents of cells
in a new document as plain text (trust me, there's a number of good
reasons why Table | Convert | Table to Text is unacceptable for this
application).

The statement
sCellText = ActiveDocument.Tables(ioTableIndex).Rows
(oRow.Index).Cells(4).Range.Text
works just fine for pulling out the text to write to the target
document. It will not, of course, pick up any graphic that may be in
the source cell.

The question then, is how does one use VBA to:
1. determine whether there is a graphic in the cell, and
2. copy such a graphic for a later paste

Short of someone offering a simple approach I'm unaware of, I can
envision a pre-processing scheme in which one could loop and use
ActiveDocument.InlineShapes(i).Select to grab the shapes individually,
use the Information property to determine if the selected shape were
in a cell, and if so, paste some information identifying the shape
into the cell. Then, when the main parsing pass is run, the code
could detect the markers and grab the appropriate shape for subsequent
pasting.

I'm just hoping I don't need to resort to such a scheme.

thanks in advance for any bits of insight,
david
 

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