Selecting and Formatting First Row of Every Table Within a Document

I am working with a large MS Word file (hundreds of pages).  It contains many, many tables.  I would like to select the first row of every table, make the font 8 point Times New Roman, and center the text within the first row.  I found a solution that accomplishes everything but center the text of the row.
Teresa HowellAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:

This will set the horizontal alignment of all the cells in the first row of all the tables in the active document to Center.
Dim tbl As Table
Dim rw As Row
Dim cl As Cell

    For Each tbl In ActiveDocument.Tables
        Set rw = tbl.Rows(1)
        For Each cl In rw.Cells
            cl.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
        Next cl
    Next tbl

Open in new window

If you also want to set the vertical alignment you can add this to the loop.
            cl.VerticalAlignment = wdCellAlignVerticalCenter

Open in new window

Teresa HowellAuthor Commented:
Thank you, Norie!  It worked perfectly for me and was just what I needed.  I couldn't be happier.  You've saved me hours upon hours of work.  This is fantastic.  

Thank you, again.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.