How do you insert table realignment within a loop?

M

MichaelB

Can someone help me insert a statement that would realign the table to right
of the page (the below script was provided by Jay Freedman). I believe the
statement is Rows.Alignment = wdAlignRowRight but I’m having trouble
inserting into the loop so that all the tables within the document are
realigned. Any help would be greatly appreciated.

Thanks
Mike

********************************

Sub ResizeTables()
Dim oTbl As Table

For Each oTbl In ActiveDocument.Tables
With oTbl
If .Columns.Count = 4 Then
.AutoFitBehavior Behavior:=wdAutoFitFixed
.Columns.PreferredWidthType = wdPreferredWidthPoints
.Columns(1).PreferredWidth = InchesToPoints(1#)
.Columns(2).PreferredWidth = InchesToPoints(0.69)
.Columns(3).PreferredWidth = InchesToPoints(0.63)
.Columns(4).PreferredWidth = InchesToPoints(3#)
End If
End With
Next oTbl
End Sub
 
J

Jean-Guy Marcil

MichaelB was telling us:
MichaelB nous racontait que :
Can someone help me insert a statement that would realign the table
to right of the page (the below script was provided by Jay Freedman).
I believe the statement is Rows.Alignment = wdAlignRowRight but I'm
having trouble inserting into the loop so that all the tables within
the document are realigned. Any help would be greatly appreciated.

Thanks
Mike

********************************

Sub ResizeTables()
Dim oTbl As Table

For Each oTbl In ActiveDocument.Tables
With oTbl
If .Columns.Count = 4 Then
.AutoFitBehavior Behavior:=wdAutoFitFixed
.Columns.PreferredWidthType = wdPreferredWidthPoints
.Columns(1).PreferredWidth = InchesToPoints(1#)
.Columns(2).PreferredWidth = InchesToPoints(0.69)
.Columns(3).PreferredWidth = InchesToPoints(0.63)
.Columns(4).PreferredWidth = InchesToPoints(3#)
End If
End With
Next oTbl
End Sub

Like this:

End If
.Rows.Alignment = wdAlignRowRight
End With


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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