How do you test to see if your insertion point is inside a table?

H

Henry Stock

Would sombody please give me a hint on how to do this?

I have a 300 page word document that I am supposed to use as the basis for
building a help project.
The document has many images in it, many that allow word wrapping. This
doesn's convert very well
to the html format that I have to use for the help, so I want to build a
macro that will search for all images and
allow me to enclose these images inside tables and left align both the
tables and images

One of the issues that I face is that some of the images are already inside
a table and for these I do not want to
add yet another surroundng table. But I don't know how to test to see if my
selection is inside a table.

The code below I got from just recording a macro. This finds and selects
images.

Selection.Find.ClearFormatting
With Selection.Find
.Text = "^g"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
 
T

Tony Jollans

What you want is

Selection.Information(wdWithInTable) = True/False

Enjoy,
Tony
 
H

Henry Stock

Thanks Tony. That did help.

Do you by any chance know why my search clause would miss some images and
not others?
It seems like not all the images I see in the document get hit on by the
search mechanism.

Another thing I am curious about is why,when the document is saved as html
some images end up as .png files while others end up as .jpg. If there were
a way to control this I would prefer all .jpg
 
K

Klaus Linke

Hi Henry,
Do you by any chance know why my search clause would miss some images
and not others?
It seems like not all the images I see in the document get hit on by the
search mechanism.

EditFind can only find pictures that are inline with the text (inline
shapes). For others, you'd need to look at the Shapes collection.
Another thing I am curious about is why,when the document is saved
as html some images end up as .png files while others end up as .jpg.
If there were a way to control this I would prefer all .jpg

I don't think you can influence that. It probably depends on the original
format.
You might ask in the word.drawing.graphics group though.

Greetings,
Klaus
 

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