Macro inserting customised table

  • Thread starter Thread starter Andrea
  • Start date Start date
A

Andrea

We have PowerPoint XP and are writing a macro to insert a
table formatted in our firm's colours. We have the table
inserting and have set shading to the cells but are having
trouble setting the borders of the cells/tables.

Any suggestions?
 
Andrea,
No methods are available to set the border property directly. However since
the table is nothing but a collection of shapes, you can create a simple
wrapper to achieve it.

' ----- Beginning Of Code -----
Option Explicit
Sub Test()
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
' ----- End Of Code -----
--
Regards
Shyam Pillai

Secure Pack
http://www.mvps.org/skp/securepack
 
Thanks very much for that Shyam. We will have a play with
that code and see how we go!

Cheers,

Andrea
 
Back
Top