鄭有維
鄭有維

Reputation: 265

How to check the paragraph start of equation?

There is the paragraph which is like

a =a_1 (x ̃_B [n]+x ̃_W [n] ) ------ equation 01

How can I know it is start of equation via word vba?

There is equation shape when the cursor stop at the equation.

But I can't get the shpae when I use Range class.

Upvotes: 0

Views: 93

Answers (1)

鄭有維
鄭有維

Reputation: 265

1.Find the first OMath object in the paragraph.

2.Compare with the start position of the paragraph.

Dim OMathStart as Long
OMathStart = -1
if ThisDocument.Paragraphs(100).Range.OMaths.Count > 0 then
    OMathStart = ThisDocument.Paragraphs(100).Range.OMaths(1).Range.Start
end if
If OMathStart > 0 and OMathStart = ThisDocument.Paragraphs(100).Range.Start then
    'Mean the Paragraph's Start position is same as OMathStart
end if

Upvotes: 1

Related Questions