frtadros
11-08-2017, 12:14 PM
Hi, I have a powerpoint presentation and each slide has a table
for each row in the table, I want to copy the color of the text in the first cell to all cells in the same row
this is the code but it just does not do anything
thank you
Sub ChangeColor(sStart As Integer, sEnd As Integer)
Dim sColor As Long
Dim oSld As Slide
Dim oShp As Shape
Dim oRow As Row
Dim oCell As Cell
Dim x As Long
Dim oColor As Long
With ActivePresentation
For I = sStart To sEnd + 1
Set oSld = ActivePresentation.Slides(I)
For Each oShp In oSld.Shapes
If oShp.HasTable Then
For Each oRow In oShp.Table.Rows
For Each oCell In oRow.Cells
If oCell.Shape.TextFrame.HasText Then
With oCell.Shape.TextFrame.TextRange
For x = 1 To .Runs.Count
If x = 1 Then
oColor = .Runs(x).Font.Color.RGB
Else
.Runs(x).Font.Color.RGB = oColor
End If
Next x
End With
End If 'has text
Next oCell
Next oRow
End If
Next oShp
Next I
End With
End Sub
for each row in the table, I want to copy the color of the text in the first cell to all cells in the same row
this is the code but it just does not do anything
thank you
Sub ChangeColor(sStart As Integer, sEnd As Integer)
Dim sColor As Long
Dim oSld As Slide
Dim oShp As Shape
Dim oRow As Row
Dim oCell As Cell
Dim x As Long
Dim oColor As Long
With ActivePresentation
For I = sStart To sEnd + 1
Set oSld = ActivePresentation.Slides(I)
For Each oShp In oSld.Shapes
If oShp.HasTable Then
For Each oRow In oShp.Table.Rows
For Each oCell In oRow.Cells
If oCell.Shape.TextFrame.HasText Then
With oCell.Shape.TextFrame.TextRange
For x = 1 To .Runs.Count
If x = 1 Then
oColor = .Runs(x).Font.Color.RGB
Else
.Runs(x).Font.Color.RGB = oColor
End If
Next x
End With
End If 'has text
Next oCell
Next oRow
End If
Next oShp
Next I
End With
End Sub