find a table within a document

M

MichaelB

I am trying to figure out how to find specific tables within a document. I
have several tables within some rather large document that need to be
modified to a new format. I’m having trouble identifying how to create the
search for tables that have either “4†columns or “5†columns within. Once I
find these tables I then need to modify the column widths as well as some
other basic configuration (test wrapping, vertical alignment, etc). If
someone could help me out with the search criteria I’m sure I can put the
rest together.

Any help would be greatly appreciated…
Thanks
Mike
 
J

Jezebel

Set 'table' as your browse object by clicking the little circle between the
double up/down arrows at the base of the vertical scroll bar. Then click the
double down arrow until you get to a table with four or five columns. (At
least I assume that's what you mean by "4" and "5" -- or is there hidden
significance here?)

There's no way to use Find to look for tables as such.

There are VBA methods, but doesn't sound like you need that.
 
M

MichaelB

Jezebel,

Thanks for the response, I truly appreciate the help.

Please excuse my lack of information but I am looking for the VBA way to
perform this search. I need to find a way to search for all the tables within
the document with four/five columns defined so I can then implement
alterations to the table layout.

Thanks again..
Mike
 
J

Jezebel

Ah. The question would have been better posted to the VBA forum. No matter.

From VBA you iterate the Tables collection ---

Dim pTable as Word.Table

For each pTable in ActiveDocument.Tables
...
Next

You can use pTables.Columns.Count to check the number of columns; but be
aware that this property may be unavailable if the table is not uniform --
if it contains merged or split cells.
 
M

MichaelB

Jezebel,

Thank you sooooo much for the help…! Being a novice to VBA I am just finding
out all the possibilities and power that VBA offers. I am very grateful that
there are people like you who are willing to help beginners like me.

Mike
 

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