user8285660
user8285660

Reputation:

Center table to word doc from excel vba

Trying to center the table but this doesn't seem to be working. Looking for some sort of "wdtablecenter" reference.

Dim equip As Integer
equip = 11
Do While Sheet2.Cells(equip, 4).Value <> 0
    wdapp.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Sheet2.Rows(equip).Copy
    wdapp.Selection.PasteAndFormat wdFormatOriginalFormatting
    wdapp.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    equip = equip + 1
Loop

Upvotes: 3

Views: 4553

Answers (1)

xidgel
xidgel

Reputation: 3145

Try something like:

ActiveDocument.Tables(1).Rows.Alignment = wdAlignRowCenter

You can fiddle with ActiveDocument.Tables(1) to select which tables to center.

Hope that help.

Upvotes: 3

Related Questions