text boxes within a table

T

Tony Logan

I've written a macro that identifies all text boxes in a document, then
extracts the data from each text box and makes it normal paragraph text that
appears (approximately) as the next paragraph after that particular text
box's respective anchor.

I'm currently doing this by identifying each text box, converting it to a
frame, then deleting the frame so that the text box data becomes a normal
paragraph.

The reason I chose to convert the text boxes to frames was simply because
there seemed to be more ways to manipulate frames and the data therein than
text boxes (read "this was the only way I knew how to do what I wanted to
do").

However, when a text box appears within a table, converting it to a frame
splits the table, and that's a no-no for our overall process of handling the
data. I thought a solution might be to look one character in front of and one
character behind the frame, and if both of those selection points are in
tables, move the frame data after the second table, then join the two tables.

But the amount of code required for this solution seems pretty substantial
(at least the way I've written it), plus there's a fair chance of an error
when searching for tables before and after the frame.

I'd leave the text boxes as text boxes if I could figure out a way to detect
whether they're in a table or not; however, this seems dependent on how the
user inserts them, and we have no control over this. For instance, if a user
sets the text box Text Wrapping option to "In front of text," testing for
whether the text box was within a table would return false, which leads back
to part of the reason why I chose to convert the text boxes to frames. But
then converting to frames introduces the split table problem...

Just curious if anyone has a better suggestion.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?VG9ueSBMb2dhbg==?=,
I'd leave the text boxes as text boxes if I could figure out a way to detect
whether they're in a table or not
The following tells you whether the selected shape is within a table:

Selection.ShapeRange(1).Anchor.Information(wdWithInTable)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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