How to identify Object type in macro?

A

Al

I need a macro to go through a document and open then close every Equation
Editor object. This works until it hits an OLE which is not Equation
Editor.
' Macro1 Macro
' Macro recorded 2/4/2004 by Al
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^g"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute
Selection.InlineShapes(1).OLEFormat.DoVerb VerbIndex:=1
With Selection.Application
SendKeys "%fx", True
End With
Loop

I think I need to add an If statement after my Do While .Execute
like this
If .OLEFormat.ClassType="Microsoft Equation 3.0" Then
Selection.InlineShapes(1).OLEFormat.DoVerb VerbIndex:=1
With Selection.Application
SendKeys "%fx", True
End If
But the editor will not accept this.
Can someone tell me what I am doing wrong?

Thanks.
 
W

Word Heretic

G'day Al <[email protected]>,

first test the value of .OLEFormat.ClassType


Steve Hudson - Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: steve at wordheretic.com


Al reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top