Sometimes the table can be too tall and you wish you
could just split the table over two slides automatically. Let us explore
how we can achieve it in this article. The whole process involves a
fixed set of steps. I've broken them up into independant functions and
1. Check if the table is out of the slide area and
determine which is the first row that moves off the slide.
|2. Copy that row onwards to a new slide
Sub CopyToNewTable(oSlide As Slide, oSourceShape As
Shape, RowIndex As Long)
Dim oTableShape As Shape
Dim I As Long
Dim J As Long
Set oTableShape =
oSlide.Shapes.AddTable(oSourceShape.Table.Rows.Count - RowIndex + 1, _
For I = 1 To oTableShape.Table.Rows.Count
For J = 1 To oTableShape.Table.Columns.Count
'Copy the text from the cell.
oSourceShape.Table.Cell(RowIndex + I - 1,
'Paste it into the new location.
oTableShape.Table.Rows(I).Height = oSourceShape.Table.Rows(RowIndex + I
|3. Delete the copied rows from the source table from the
main routine. Let us bring it altogether into this routine.
Dim RowIndex As Long
Dim oSld As Slide
Dim I As Long
Set oShp =
'Check if the selected shape is a
If Not oShp.HasTable Then
"This is not a table.", vbExclamation
'Get the row at which
table moves off the slide
RowIndex = GetRowOverFlowIndex(oShp,
'If no rows
are out of slide, just get out otherwise process it
RowIndex > 0 Then
'Add a new slide for the a new table
oSld = ActivePresentation.Slides.Add(oShp.Parent.SlideIndex + 1,
'Now copy the rows to the new table.
CopyToNewTable(oSld, oShp, RowIndex)
'Delete the rows
from the original table
For I =
oShp.Table.Rows.Count To RowIndex Step -1
To test this code:
1. Create a table with 10 rows such some of
the rows are overflow out of the slide area.
2. Select the table shape.
3. Run the
Note this does not work with PPT 2007. Tables are broken in the object
model in PPT 2007.
2. This examples works on the current shape
selection in PowerPoint, you can easily extend it to work on all the
tables in the presentation.