Thread: [Solved] Copy table format
View Single Post
 
Old 08-31-2012, 06:42 PM
efilipe efilipe is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Aug 2012
Posts: 3
efilipe is on a distinguished road
Default

Table Format Copy

Select a table that you have formatted exactly how you like it, run this and all other tables in the presentation will copy the format. Note the format of the first cell is used to set the overall format. If cells in a table have different formats they will all be set to the format of the first cell.

Sub tabufix()
Dim otbl As Table, osld As Slide, IRow As Integer, ICol As Integer
On Error GoTo errhandler
If ActiveWindow.Selection.ShapeRange.Count <> 1 Then GoTo errhandler
If ActiveWindow.Selection.ShapeRange.Type <> msoTable Then
MsgBox "You haven't selected a table"
Exit Sub
End If
Set otbl = ActiveWindow.Selection.ShapeRange.Table
With otbl
.Cell(1, 1).Shape.PickUp
End With
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoTable Then
For IRow = 1 To oshp.Table.Rows.Count
For ICol = 1 To oshp.Table.Columns.Count
oshp.Table.Cell(IRow, ICol).Shape.Apply
Next ICol
Next IRow
End If
Next oshp
Next osld
Exit Sub
errhandler:
MsgBox "Error, Did you select just one thing?"
End Sub
Reply With Quote