Skip to content

Make equations blue in powerpoint

September 4, 2019

Microsoft Powerpoint has a surprisingly powerful equation editor, which also allows to use latex macros such as \alpha to get \alpha.

I’ve blogged about the equation editor before but one pet peeve of mine was that I like to have my math in a different color, but never found a way to do this automatically. I finally decided to invest the time and find out how to do it. After a mere several years of investigation, I am happy to report that it is in fact possible to do so using Visual Basic for Applications (VBA).

You can view the developer tab by following these instructions, and then click on “macros”, type a name such as All_eqs and click on “create” at which point you can add the following code:

Sub All_eqs()

Dim oSld As Slide
Dim oShp As Shape
Dim oShapes As Shapes
For Each oSld In ActivePresentation.Slides
  Set oShapes = oSld.Shapes
  For Each oShp In oShapes
   If oShp.HasTextFrame Then
      If oShp.TextFrame.HasText Then
                With oShp.TextFrame.TextRange
                    For x = 1 To .Characters.Count
                        If .Characters(x).Font.Name = "Cambria Math" Then
                            .Characters(x).Font.Color.RGB = RGB(0, 112, 192)
                        End If
                    Next x
                End With

    End If
    End If
    Next oShp
 Next oSld
End Sub

Comments are closed.

%d bloggers like this: