Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' cobbled together between these two scripts
- ' https://stackoverflow.com/questions/31821984/formatting-table-in-powerpoint-macro
- ' http://skp.mvps.org/pptxp009.htm
- Option Explicit
- Sub format()
- Dim s As Slide
- Dim oSh As Shape
- Dim oTbl As Table
- Dim lRow As Long
- Dim lCol As Long
- For Each s In ActivePresentation.Slides
- ' If you choose Debug | Compile, this next line fails
- ' There's no such property as .Table
- ' With s.Shapes.Table
- For Each oSh In s.Shapes
- If oSh.HasTable Then
- Set oTbl = oSh.Table
- Call SetTableBorder(oTbl)
- ' For lRow = 1 To oTbl.Rows.Count
- ' For lCol = 1 To oTbl.Columns.Count
- ' With oTbl.Cell(lRow, lCol).Shape.TextFrame.TextRange
- ' .Font.Name = "Arial"
- ' .Font.Size = 30
- ' End With
- ' Next
- ' Next
- End If
- Next ' Shape
- Next s
- End Sub
- ' Option Explicit
- ' Sub HowToUseIt()
- ' Call SetTableBorder(ActivePresentation.Slides(1).Shapes(1).Table)
- ' End Sub
- Sub SetTableBorder(oTable As Table)
- Dim I As Integer
- With oTable
- For I = 1 To .Rows.Count
- With .Rows(I).Cells(1).Borders(ppBorderLeft)
- .ForeColor.RGB = RGB(255, 255, 255)
- .Weight = 5
- End With
- With .Rows(I).Cells(.Rows(I).Cells.Count).Borders(ppBorderRight)
- .ForeColor.RGB = RGB(255, 255, 255)
- .Weight = 5
- End With
- Next I
- For I = 1 To .Columns.Count
- With .Columns(I).Cells(1).Borders(ppBorderTop)
- .ForeColor.RGB = RGB(255, 255, 255)
- .Weight = 5
- End With
- With .Columns(I).Cells(.Columns(I).Cells.Count).Borders(ppBorderBottom)
- .ForeColor.RGB = RGB(255, 255, 255)
- .Weight = 5
- End With
- Next I
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement