OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy

Set table border colour

 

No direct methods are available to set the table border property for native PowerPoint tables. However since the PowerPoint table just special collection of shapes, you can create a simple wrapper to achieve it. This can be extended to apply various border styles.

 

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, 0, 0)
            .Weight = 5
        End With
        With .Rows(I).Cells(.Rows(I).Cells.Count).Borders(ppBorderRight)
            .ForeColor.RGB = RGB(255, 0, 0)
            .Weight = 5
        End With
    Next I
    For I = 1 To .Columns.Count
        With .Columns(I).Cells(1).Borders(ppBorderTop)
            .ForeColor.RGB = RGB(255, 0, 0)
            .Weight = 5
        End With
        With .Columns(I).Cells(.Columns(I).Cells.Count).Borders(ppBorderBottom)
            .ForeColor.RGB = RGB(255, 0, 0)
            .Weight = 5
        End With
    Next I
End With
End Sub

 

Copyright 1999-2014 (c) Shyam Pillai. All rights reserved.