Retrieving table style information

A

andreas

Dear Experts:

I got a document with a lot of tables where I applied user-defined
table styles (name convention: all beginning with "tbl_style_ ") to
about 50% of the tables:

Is it possible thru a macro to retrieve the table style for each
table: Example:

Table 3: tbl_style_blue
Table 4: tbl_style_blue
Table 5: tbl_style_red
Table 7: tbl_style_grey
Table 1, 2, 6: no user-defined table style applied

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
 
F

Fumei2 via OfficeKB.com

Sub EachTableStyle()
Dim oTable As Table
For Each oTable In ActiveDocument.Tables
MsgBox oTable.Range.Style
Next
End Sub

If a table uses a table style, you get the name. If it does not, you get
"Table Grid".
 
S

Stefan Blom

Actually, "Table Grid" is also a style; it's one of the built-in table
styles.
 
A

andreas

Sub EachTableStyle()
Dim oTable As Table
For Each oTable In ActiveDocument.Tables
   MsgBox oTable.Range.Style
Next
End Sub

If a table uses a table style, you get the name.  If it does not, you get
"Table Grid".

Hi Fumei,

exactly what I was after. Thank you very much for your terrific help.
Regards, Andreas
 
A

andreas

Actually, "Table Grid" is also a style; it's one of the built-in table
styles.

--
Stefan Blom
Microsoft Word MVP






- Show quoted text -

Hey Stefan,

thank you for your professional support. Regards, Andreas
 

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