delart
delart

Reputation: 51

Remove cell borders with VBA PowerPoint?

Simple question but I don't manage to remove table cell borders in a table using VBA in PowerPoint.

I guess the following code should work but it doesn't do anything - any clues why?

No error message but the cells borders remain.

 Sub RemoveCellsBorders()

    Set oTbl = ActiveWindow.Selection.ShapeRange.Table
     
      For X = 1 To oTbl.Columns.Count
            For Y = 1 To oTbl.Rows.Count
    
                    If oTbl.cell(Y, X).Selected Then
                    
                            oTbl.cell(Y, X).Borders(ppBorderTop).Visible = False
                            oTbl.cell(Y, X).Borders(ppBorderBottom).Visible = False
                            oTbl.cell(Y, X).Borders(ppBorderLeft).Visible = False
                            oTbl.cell(Y, X).Borders(ppBorderRight).Visible = False

                    End If
                    
            Next 'y
        Next 'x

End Sub

Upvotes: 0

Views: 300

Answers (1)

Kin Siang
Kin Siang

Reputation: 2699

Change the following code, then border will be removed, for unknown reason, visible = false is not working in ppt now and make sure you have select the table.

If oTbl.Cell(y, x).Selected Then
    oTbl.Cell(y, x).Borders(ppBorderTop).Transparency = 1
    oTbl.Cell(y, x).Borders(ppBorderBottom).Transparency = 1
    oTbl.Cell(y, x).Borders(ppBorderLeft).Transparency = 1
    oTbl.Cell(y, x).Borders(ppBorderRight).Transparency = 1

End If 

Upvotes: 1

Related Questions