Inserting equation numbers macro

Posted by krzych on Stack Overflow See other posts from Stack Overflow or by krzych
Published on 2012-11-26T20:04:58Z Indexed on 2012/11/27 5:04 UTC
Read the original article Hit count: 153

Filed under:
|

I want to insert equations into Word 2010. I'm inserting the center-aligned equations and then want to add a number to the same line, which will be aligned to the right hand side of the page.

enter image description here

I'm having a problem with setting the alignment of the number to the right with equation aligned to center.

My code is currently only inserting the number without the correct alignment:

Sub EqnNumber()
    Selection.TypeText Text:="("
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
        Text:="STYLEREF  \s ""Naglówek 1"" ", PreserveFormatting:=True
    Selection.TypeText Text:="."
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
        Text:="SEQ Rysunek \* ARABIC \s 1", PreserveFormatting:=True
    Selection.TypeText Text:=")"
End Sub

© Stack Overflow or respective owner

Related posts about vba

Related posts about word-vba