Skip to content

Instantly share code, notes, and snippets.

@haschdl
Created March 20, 2020 10:19
Show Gist options
  • Save haschdl/65dc6208b8bbdeb966173be4ed67650d to your computer and use it in GitHub Desktop.
Save haschdl/65dc6208b8bbdeb966173be4ed67650d to your computer and use it in GitHub Desktop.
Change PowerPoint colors
Sub ChangeTextColors()
Dim oSl As Slide
Dim oSh As Shape
Dim x As Long
Dim lOldColor As Long
Dim lNewColor As Long
' Set lOldcolor to the RGB value you're looking for
lOldColor = RGB(205, 32, 38)
' Set lNewColor to the RGB value you want to change it to
lNewColor = RGB(33, 71, 71)
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If oSh.HasTextFrame Then
If oSh.TextFrame.HasText Then
With oSh.TextFrame.TextRange
For x = 1 To .Runs.Count
If .Runs(x).Font.Color.RGB = lOldColor Then
.Runs(x).Font.Color.RGB = lNewColor
End If
Next
End With
End If
End If
Next
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment