I have a Word 2002 document produced from an external application with
many Equation editor objects. However, the equations do not properly
line up with the other text on the line. If I select an equation and open
the Equation editor then close it without making any changes, the
misalignment gets corrected. I need a macro to go through the document
and for each Equation Editor object, open Equation Editor and close it.
I recorded a macro to do this with Find ^g. (I did get help with the
SendKeys to close the application). It works OK until it finds a graphic
which is not Equation Editor then halts. I think I need to add
something like this:
If .Type = msoLinkedOLEObject Then
If .OLEFormat.ClassType = "Microsoft Equation 3.0" Then
But I cannot figure out where and how to do this.
Your help is greatly appreciated.
Sub OpenCloseEqEd()
'
' Macro recorded 2/4/2004
Application.DisplayAlerts = wdAlertsNone
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^g"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
Do While .Execute
Selection.InlineShapes(1).OLEFormat.DoVerb VerbIndex:=1
With Selection.Application
SendKeys "%fx", True
End With
Loop
End With
End Sub
Tony Jollans - 18 Jan 2006 00:35 GMT
Something like this ...
Do While .Execute
With Selection.InlineShapes(1)
If .Type = wdInlineShapeEmbeddedOLEObject Then
If .OLEFormat.ClassType = "Equation.3" Then
.OLEFormat.DoVerb VerbIndex:=1
With Selection.Application
SendKeys "%fx", True
End With
End If
End If
End With
Loop
--
Enjoy,
Tony
> I have a Word 2002 document produced from an external application with
> many Equation editor objects. However, the equations do not properly
[quoted text clipped - 30 lines]
> End With
> End Sub