kerrypnx
10/8/2018 - 3:53 AM

put equation into table

revise 10-8

Sub putEquationIntoTable()
    Dim myMath As OMath
    Dim myField As Field
    For Each myMath In ActiveDocument.OMaths
        myMath.Range.Select
           Call formatEquation
    Next
    
    For Each myField In ActiveDocument.Fields
        myField.Select
        If Selection.Type = 7 Then
       
          Call formatEquation
       
        End If
    Next
End Sub
Function formatEquation()

        If Selection.Information(wdWithInTable) Then
                 
            Selection.Tables(1).Select
             Selection.Style = ActiveDocument.Styles("MDPI_equationFram")
            Else
            If Selection.Next = ChrW(13) And Selection.Previous = ChrW(13) Then
            Selection.Cut
            Call EquationFrameNo
            Selection.MoveDown wdLine, 1
            End If
        End If
End Function