Follow-up: Microsoft Word – Getting rid of unused fields in equations (small dotted squares)
Dear All,
This is a follow-up from post https://techcommunity.microsoft.com/t5/microsoft-365/microsoft-word-getting-rid-of-unused-fields-in-equations-small/m-p/4269588#M54220
(which I believe is not seen anymore since a first solution was proposed))
Apparently due to an Apr 2024 bug in Word, “placeholder” boxes in Word equations are displaying when printed or converted to PDF when they did not used to. I’m trying to get a working macro to detect such empty fields and delete them (or at least, populate them with an empty space ” ” so that the small dotted squares don’t show anymore).
I’m trying to have a working macro, unfortunately without success yet.
Equations are indeed detected, if I display them I see their fields (all in 1 MsgBox).
Now, the eq itself will not be “empty”, some of of the eq fields might be.
I cannot find a way to go through each field of each equation, and then delete (or assign ” “) to each empty field.
Your opinion and help on this would be most welcome!
Thank you!
Sub SearchEmptyFields() Dim eq As OMath 'Trying to define a range to go through eq fields Dim r As Range For Each eq In ActiveDocument.OMaths 'This displays all fields of the current eq MsgBox ("Found: " & eq.Range.Text) 'Trying to get through each field of the current eq... without success 'For Each r In eq.Rang."element???" ' MsgBox ("Range: " & eq.Range.element.Text) ' Do a "delete" or put field value to " " 'Next r Exit Sub Next eq
Dear All, This is a follow-up from post https://techcommunity.microsoft.com/t5/microsoft-365/microsoft-word-getting-rid-of-unused-fields-in-equations-small/m-p/4269588#M54220(which I believe is not seen anymore since a first solution was proposed)) Apparently due to an Apr 2024 bug in Word, “placeholder” boxes in Word equations are displaying when printed or converted to PDF when they did not used to. I’m trying to get a working macro to detect such empty fields and delete them (or at least, populate them with an empty space ” ” so that the small dotted squares don’t show anymore). I’m trying to have a working macro, unfortunately without success yet.Equations are indeed detected, if I display them I see their fields (all in 1 MsgBox).Now, the eq itself will not be “empty”, some of of the eq fields might be.I cannot find a way to go through each field of each equation, and then delete (or assign ” “) to each empty field. Your opinion and help on this would be most welcome! Thank you! Sub SearchEmptyFields()
Dim eq As OMath
‘Trying to define a range to go through eq fields
Dim r As Range
For Each eq In ActiveDocument.OMaths
‘This displays all fields of the current eq
MsgBox (“Found: ” & eq.Range.Text)
‘Trying to get through each field of the current eq… without success
‘For Each r In eq.Rang.”element???”
‘ MsgBox (“Range: ” & eq.Range.element.Text)
‘ Do a “delete” or put field value to ” “
‘Next r
Exit Sub
Next eq Read More