Can't believe they did this? Easy way to fix?

E

Ed

This table looked rather odd. On closer inspection, it was not a table, but
totally created from individual drawing objects!! Each cell is its own text
box, and each border is a separate line!

Anyone got a rabbit in their hat for fixing this and making it a real table?

Ed
 
J

Jay Freedman

This table looked rather odd. On closer inspection, it was not a table, but
totally created from individual drawing objects!! Each cell is its own text
box, and each border is a separate line!

Anyone got a rabbit in their hat for fixing this and making it a real table?

Ed

Hi Ed,

"Nothing is foolproof because fools are so ingenious!" ;-)

This chunk of code, applied to a copy of the original text, will
remove the text boxes and leave the contents of each "cell" as a
separate paragraph of plain text. (Use a copy because the code will
also kill off any direct formatting, such as indents or line spacing,
plus you'll need to refer to the original for the following step.)

Dim oTB As Shape
Dim oRg As Range

' convert all textboxes to frames
For Each oTB In ActiveDocument.Shapes
If oTB.Type = msoTextBox Then
oTB.ConvertToFrame
End If
Next oTB

' remove all applied para format
' which removes frames
Set oRg = ActiveDocument.Range
oRg.ParagraphFormat.Reset

After that, you'll have to manually move the text into the cells of a
real table. The problem with automating this is that the order of the
cleaned text paragraphs is unpredictable (it will probably the the
reverse of the order in which the original text boxes were created,
assuming they were all anchored in the same paragraph).
 
E

Ed

Jay:
"Nothing is foolproof because fools are so ingenious!"
LOL!! I will have to put that on my cubicle wall!! Especially given the
people I work with!

Unfortunately, the code did not work. I copied the "table" onto a new
document, ungrouped everything, and then ran the macro. Nothing. It never
recognized any text boxes in the If statement.

Thanks for the help, Jay, but it's actually going to be easier to retype the
whole thing in manually than to figure out a macro for this mess. I guess
fools can do some things even VBA isn't magical enough to handle. 8>)

Ed
 

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