I'm looking to automate a tedious part of my job with visual basic in Word. I work on long word documents and tables have to be certain widths (6.5 inches [or 468 points] in portrait orientation and 9 inches [or 648 points] in landscape). So far I have
Sub TableResize()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
oTbl.AutoFitBehavior wdAutoFitFixed
With ActiveDocument.PageSetup
oTbl.PreferredWidthType = wdPreferredWidthPoints
oTbl.PreferredWidth = 468
oTbl.Rows.Alignment = wdAlignRowCenter
End With
Next oTbl
End Sub
Which works great to set ALL tables to 6.5 inches and align them to the center, but this of course screws up the tables on pages that are landscape oriented. Can anyone help me to set the table widths according to the page layout?
Thanks, Ben