Make equations blue in powerpoint

Windows On Theory 2019-09-04

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 SlideDim oShp As ShapeDim 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 oSldEnd Sub