Vertically and Horizontally Align text in tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I programmatically align text in tables so that it's centered
vertically and horizontally.

Thanks,
Barb Reinhardt
 
Hi Barb

Did you solve the gradient fill macro? (We can help if you didn't Email me)

This code will set all tables in the pres to middle centred text

Sub tablealign()
On Error GoTo errhandler
Dim Icol As Integer, Irow As Integer, oshp As Shape, osld As Slide
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoTable Then
With oshp.table
For Irow = 1 To .Rows.Count
For IColumn = 1 To .Columns.Count
With .Cell(Irow, IColumn).Shape.TextFrame
..HorizontalAnchor = msoAnchorCenter
..VerticalAnchor = msoAnchorMiddle
End With
Next IColumn
Next Irow
End With
End If
Next
Next
Exit Sub
errhandler:
MsgBox "sorry there's an error!", vbCritical, "www.PPTAlchemy.co.uk"
End Sub
 
Thanks. I got the gradients working. I just couldn't figure out the anchor
issue.

Thanks again.
 
Back
Top