Macro to start MathType Equation editor.

N

Neal Carron

I use MathType in Word 2003 and 2007 as my equation editor.
In a document, to open the equation editor window you must click on the
MathType tab, then click on Insert Equation.
I’d prefer to do this with a keystroke command, by defining a macro and
assigning it to, say, Ctrl-Q.
I’d like the macro to just open the equation editor window, then stop. (I
will then write the equation and close the window in MathType’s usual way).
But apparently you are not allowed to stop the macro in the EqEd window.
So how do I write such a macro?
Thanks,
Neal Carron
 
J

Jean-Guy Marcil

Neal Carron was telling us:
Neal Carron nous racontait que :
I use MathType in Word 2003 and 2007 as my equation editor.
In a document, to open the equation editor window you must click on
the MathType tab, then click on Insert Equation.
I'd prefer to do this with a keystroke command, by defining a macro
and assigning it to, say, Ctrl-Q.
I'd like the macro to just open the equation editor window, then
stop. (I will then write the equation and close the window in
MathType's usual way). But apparently you are not allowed to stop the
macro in the EqEd window. So how do I write such a macro?
Thanks,
Neal Carron

Would this be what you are looking for?

Selection.InlineShapes.AddOLEObject ClassType:="Equation.3", FileName:="", _
LinkToFile:=False, DisplayAsIcon:=False
 
N

Neal Carron

Thank you.
What you suggested is for an in-line equation.
I'm really looking for a Displayed Right-numbered equation.
Any way to do that?
- Neal
 
J

Jean-Guy Marcil

Neal Carron was telling us:
Neal Carron nous racontait que :
Thank you.
What you suggested is for an in-line equation.
I'm really looking for a Displayed Right-numbered equation.

Do you mean aligned on the right margin as a floating shape?
Any way to do that?

Try this:

Dim ilshpEquation As InlineShape
Dim shpEquation As Shape

Set ilshpEquation = Selection.InlineShapes _
.AddOLEObject(ClassType:="Equation.3", FileName:="", _
LinkToFile:=False, DisplayAsIcon:=False)

Set shpEquation = ilshpEquation.ConvertToShape

With shpEquation
.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionMargin
.RelativeVerticalPosition = _
wdRelativeVerticalPositionParagraph
.Left = wdShapeRight
.Top = InchesToPoints(0)
.LockAnchor = True
With .Line
.Style = msoLineSingle
.Weight = 1
.Visible = msoTrue
End With
With .WrapFormat
.Side = wdWrapLeft
.DistanceTop = InchesToPoints(0)
.DistanceBottom = InchesToPoints(0)
.DistanceLeft = InchesToPoints(0.13)
.DistanceRight = InchesToPoints(0.13)
.Type = wdWrapSquare
End With
End With

I have to add a line around it otherwise it will be "invisible" (It has no
content)...
 
N

Neal Carron

Well that's not exactly what I meant. The equation itself is centered, the
equation number is aligned with the right margin.
It is a floating "displayed" equation, meaning it is not inline with text,
but occupies as much vertical space as it needs (usually equivalent to just a
few lines of text). It spans the full horizontal page width, with as much
white space on left and right of the equation proper as needed.

It is the editor window you get when selecting the MathType tab, and then,
on the left "Insert Equations" panel, clicking "Right-numbered".

There is no border around it (although I suppose one could arrange for
that if one wanted).

(By the way, your suggested macro failed with the error msg:
"Run-time error '4605':
The RelativeHorizontalPosition method or property is not available
because the drawing operation cannot be applied to the current
selection.")

Thanks,
- Neal
*********
 
J

Jean-Guy Marcil

Neal Carron was telling us:
Neal Carron nous racontait que :
Well that's not exactly what I meant. The equation itself is
centered, the equation number is aligned with the right margin.
It is a floating "displayed" equation, meaning it is not inline with
text, but occupies as much vertical space as it needs (usually
equivalent to just a few lines of text). It spans the full horizontal
page width, with as much white space on left and right of the
equation proper as needed.

It is the editor window you get when selecting the MathType tab, and
then, on the left "Insert Equations" panel, clicking "Right-numbered".

It appears you are working with Word 2007.
I do not have access to Word 2007 at the moment (Had to reformat my virtual
drive...).
Hopefully someone with 2007 installed will come along and help out...
Sorry.
 

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