none
Powerpoint 2013: Converting Equations to Images RRS feed

  • Question

  • Hello,

    I would like to convert the equations in a Powerpoint 2013 presentation to images in order to avoid compatibility issues. I have tried to write a macro using VBA, but I am not sure how to identify the Equations themselves. My code so far:

    Sub EquationToImage()

        For Each slid In ActivePresentation.Slides
            For Each shap In SlideToCheck.Shapes
                If shap.HasTextFrame Then              
    ???
    ???
            Next
        Next
    End Sub

    I was expecting to find Equations in the TextFrame object. Are they stored as text? How could I identify Equations and, for instance, use CopyAsPicture on them exclusively?

    Thank you for any help you can provide!

    Tuesday, August 6, 2013 4:24 PM

Answers

  • Here is one way to do it... hope it helps.

    Sub FindEquations()
        Dim ppt As PowerPoint.Presentation
        Dim sld As PowerPoint.Slide
        Dim shp As PowerPoint.Shape
        
        Set ppt = ActivePresentation
        For Each sld In ppt.Slides
            For Each shp In sld.Shapes
                If shp.Type = msoTextBox Then
                    If shp.HasTextFrame Then
                        If shp.TextFrame.HasText Then
                            If shp.TextFrame.TextRange.Font.Name = "Cambria Math" Then
                                shp.Export "H:\myEQ.png", ppShapeFormatPNG
                            End If
                        End If
                    End If
                End If
            Next
        Next
    End Sub
    


    Kind Regards, Rich ... http://greatcirclelearning.com

    Tuesday, August 6, 2013 6:35 PM