• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 142
  • Last Modified:

word 2013 VBA - Macro Needed to 1) Find Table, 2) select first row, 3) Change font size of first row to 16 pt and font to Arial Bold

Hi All:
I have 40 or so tables in a document which need to be modified.
I need a macro to
1) Find a Table,
2) select the first row in that table,
3) Change the font size of that table's first row to 16 pt and the font to Arial Bold
4) Repeat Step 1 2 and 3 until the end of the  document is reached.
5) Generate a message box saying "Done.".
0
brothertruffle880
Asked:
brothertruffle880
  • 4
  • 3
1 Solution
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Please give this a try...


Sub FormatTableRow()
Dim doc As Document
Dim tbl As Table

Set doc = ActiveDocument
For Each tbl In doc.Tables
    With tbl.Rows(1).Range.Font
        .Bold = True
        .Size = 16
        .Name = "Arial"
    End With
Next tbl
MsgBox "Done!", vbInformation
End Sub

Open in new window

0
 
brothertruffle880Author Commented:
Hi Neeraj:
The macro is fine but I would like to see each table as it is being processed.
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
The macro is fine but I would like to see each table as it is being processed.
What do you mean by that? You cannot see the progress of the macro as it will complete the task in almost milliseconds.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
brothertruffle880Author Commented:
Hi Sudobh:
I'm running the macro using f8 I'd like to see each table.
Currently my screen remains on page 1. Where the first table is positioned.
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Okay try this...
Sub FormatTableRow()
Dim doc As Document
Dim tbl As Table

Set doc = ActiveDocument
For Each tbl In doc.Tables
    tbl.Rows(1).Select
    With tbl.Rows(1).Range.Font
        .Bold = True
        .Size = 16
        .Name = "Arial"
    End With
Next tbl
MsgBox "Done!", vbInformation
End Sub

Open in new window

0
 
brothertruffle880Author Commented:
FLAWLESS!!!  Perfect!!!!
Thank you.
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome!
Thanks for the feedback.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now