John Carney
asked on
Creating Macros in PPT 2010
I'm new to Powerpoint and I want to learn how to format table elements but unfortunately I'm using PPT 2010 and I can't record macros. Here are a few starter questions:
What is everything I would need to include in a macro that will accomplish these 3 objectives?
Thanks,
John
How do I find the table name so I can reference it in the macro?
How do I reset the shading of a row or group of rows to, say, RGB ( 102,102,153)
How do I set the vertical alignment of the table to middle?
What is everything I would need to include in a macro that will accomplish these 3 objectives?
Thanks,
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for such an easy-to-follow answer :- )
Time for a new question really but have a look at:
The border will not be very obvious with those colors.
Sub tabler()
Dim otbl As Table
Dim R As Long
Dim C As Long
Dim B As Long
Set otbl = ActivePresentation.Slides(1).Shapes("Table 6").Table
' all cells to vertical middle
For R = 1 To otbl.Rows.Count
For C = 1 To otbl.Columns.Count
otbl.Cell(R, C).Shape.TextFrame2.VerticalAnchor = msoAnchorMiddle
For B = 1 To 4 'borders left,right,top,bottom
otbl.Cell(R, C).Borders(B).Visible = msoTrue
otbl.Cell(R, C).Borders(B).ForeColor.RGB = RGB(191, 191, 191)
Next B
Next C
Next R
'rows fill
For R = 1 To otbl.Rows.Count 'rows
For C = 1 To otbl.Columns.Count 'columns
If R / 2 <> R \ 2 Then 'odd rows
otbl.Cell(R, C).Shape.Fill.ForeColor.RGB = RGB(102, 102, 153)
Else
otbl.Cell(R, C).Shape.Fill.ForeColor.RGB = RGB(229, 229, 255)
End If
Next C
Next R
End Sub
The border will not be very obvious with those colors.
ASKER
Here's my slightly modified code as of now:
Open in new window