Equation Field (or Equation Editor)

V

VBA_LOONEY

Hello,

I have been trying to programmatically add either an equation field o
using the Equation Editor.

Problem with the Equation Editor is I have only been able to add tex
using "SendKeys" which is not ideal.

I have managed to add an "Equation Field" and I can set the text
however I cannot add carriage returns to the text. Anyone know how?

What I am after is a field which states:

X - Y
______
Z

Can anybody help?

Many Thanks,
Looney
 
J

Jay Freedman

Hi Looney,

You don't need a carriage return to make that expression with an EQ
field. Use the code
{EQ \f(X - Y, Z)}

The Equation Editor isn't programmable in VBA except by SendKeys,
which is a horrible kluge, but we're stuck with it.
 
M

macropod

Hi Looney,

You could use something like:

Sub AddEQ()
Dim FldText As String
FldText = "EQ \f(X - Y,Z)"
Selection.Fields.Add Range:=Selection.Range, Text:=FldText,
PreserveFormatting:=False
End Sub

Cheers
 

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