|
Sub ppt表格文本居中1()
Dim oRow As Row
On Error Resume Next
For Each oRow In ActiveWindow.Selection.ShapeRange.Table.Rows
For j = 1 To oRow.Cells.Count
'oRow.Cells(j).Shape.TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignCenter '水平居中
oRow.Cells(j).Shape.TextFrame.HorizontalAnchor = msoAnchorCenter '水平居中
oRow.Cells(j).Shape.TextFrame.VerticalAnchor = msoAnchorMiddle '垂直居中
Next
Next
End Sub
或:
Sub ppt表格文本居中2()
Dim oRow As Row, oCell As Cell 'Row行 'Column列 'Cell单元格
On Error Resume Next
For Each oRow In ActiveWindow.Selection.ShapeRange.Table.Rows
For Each oCell In oRow.Cells
'oCell.Shape.TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignCenter '水平居中
oCell.Shape.TextFrame.HorizontalAnchor = msoAnchorCenter '水平居中
oCell.Shape.TextFrame.VerticalAnchor = msoAnchorMiddle '垂直居中
Next
Next
End Sub |
|