View Single Post
 
Old 05-06-2021, 10:49 PM
NameIsJustAnIllusion NameIsJustAnIllusion is offline Windows 10 Office 2019
Novice
 
Join Date: May 2021
Posts: 11
NameIsJustAnIllusion is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
This works for me...
Code:
Sub BreakEquations()
  Dim aField As Field
  For Each aField In ActiveDocument.Fields
    If aField.Type = wdFieldEmbed Then
        If InStr(1, aField, "Equation.3") Then aField.Unlink
    End If
  Next aField
End Sub
Credit: I found this post by Siddharth Rout which contained the clue excel - How to find equation editor in word document using VBA? - Stack Overflow
Thanks Andrew for looking into this. I tried your code on the sample file that I have attached in the 2nd post above but it doesn't work as desired. It changes it to an inline shape Type:=wdInlineShapePicture.

Code:
 Sub BreakEquations()
    Dim aField As Field
    Dim shp As InlineShape
        
    For Each shp In ActiveDocument.InlineShapes
        Debug.Print shp.Type 'OUTPUT 1 (wdInlineShapeEmbeddedOLEObject)
    Next
    
    For Each aField In ActiveDocument.Fields
        If aField.Type = wdFieldEmbed Then
            If InStr(1, aField, "Equation.3") Then aField.Unlink
        End If
    Next aField
    
    For Each shp In ActiveDocument.InlineShapes
        Debug.Print shp.Type 'OUTPUT 3 (wdInlineShapePicture)
    Next
End Sub
Want it to be converted to Office Math or to normal text. I will continue to play around.
Reply With Quote