Table Style question

F

Fuzzhead

How do I go through my document and find all the tables changing the style in
them from ‘Normal’ to ‘TableNormal’?
 
S

Shauna Kelly

Hi Fuzzhead

Off the top of my head:

Dim oTable as Word.Table
Dim oDoc as Word.Document

set oDoc = Word.ActiveDocument
for each oTable in oDoc.Tables
oTable.Style = "TableNormal"
next oTable

"TableNormal" might not be "TableNormal" in a non-English version of
Word; you'll need to add error checking to taste.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
T

Tony Jollans

wdStyleNormalTable should work for all languages.

I'm not sure, however, what you have or what you are expecting to see as a
result of this. Normal is a Paragraph Style, and Table Normal is a Table
Style; they are not interchangeable.
 
F

Fuzzhead

Hi Shauna and Tony,

Thank you for your help. I tried to run Shauna's macro and Tony was right.
It gave me a error 5849 "Could not apply the Style". What I am trying to do
is change the paragraph Style in each cell from 'Normal' to a style I created
called 'TableNormal'. I am working in English.

Fuzzhead
 
T

Tony Jollans

A slightly confusing name, but this should do it.

For Each T In ActiveDocument.Tables
For Each P In T.Range.Paragraphs
If P.Style = "Normal" Then P.Style = "TableNormal"
Next P, T
 

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