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