1 Sub NumberEquation()
2 '
3 'Вставка формулы с нумерацией.
4 '
5 Dim oRng As Range
6 Set oRng = Selection.Range
7 With oRng.ParagraphFormat
8 .SpaceAfterAuto = False: .SpaceBeforeAuto = False
9 .FirstLineIndent = 0
10 .TabStops.ClearAll
11 .TabStops.Add (oRng.Sections(1).PageSetup.PageWidth - oRng.Sections(1).PageSetup.LeftMargin - oRng.Sections(1).PageSetup.RightMargin - .LeftIndent - .RightIndent) / 2, _
12 wdAlignTabCenter, wdTabLeaderSpaces
13 .TabStops.Add oRng.Sections(1).PageSetup.PageWidth - oRng.Sections(1).PageSetup.LeftMargin - oRng.Sections(1).PageSetup.RightMargin - .LeftIndent - .RightIndent, _
14 wdAlignTabRight, wdTabLeaderSpaces
15 End With
16 With oRng
17 .InsertBefore vbTab
18 .Collapse wdCollapseEnd
19 .InsertParagraphAfter
20 .Select
21 With Selection
22 .InsertStyleSeparator
23 .TypeText vbTab & "("
24 .Fields.Add .Range, wdFieldSequence, "formula", True
25 .TypeText ")"
26 End With
27 .InlineShapes.AddOLEObject "Equation.3", , False
28 .InlineShapes(1).Select
29 End With
30 End Sub
2 '
3 'Вставка формулы с нумерацией.
4 '
5 Dim oRng As Range
6 Set oRng = Selection.Range
7 With oRng.ParagraphFormat
8 .SpaceAfterAuto = False: .SpaceBeforeAuto = False
9 .FirstLineIndent = 0
10 .TabStops.ClearAll
11 .TabStops.Add (oRng.Sections(1).PageSetup.PageWidth - oRng.Sections(1).PageSetup.LeftMargin - oRng.Sections(1).PageSetup.RightMargin - .LeftIndent - .RightIndent) / 2, _
12 wdAlignTabCenter, wdTabLeaderSpaces
13 .TabStops.Add oRng.Sections(1).PageSetup.PageWidth - oRng.Sections(1).PageSetup.LeftMargin - oRng.Sections(1).PageSetup.RightMargin - .LeftIndent - .RightIndent, _
14 wdAlignTabRight, wdTabLeaderSpaces
15 End With
16 With oRng
17 .InsertBefore vbTab
18 .Collapse wdCollapseEnd
19 .InsertParagraphAfter
20 .Select
21 With Selection
22 .InsertStyleSeparator
23 .TypeText vbTab & "("
24 .Fields.Add .Range, wdFieldSequence, "formula", True
25 .TypeText ")"
26 End With
27 .InlineShapes.AddOLEObject "Equation.3", , False
28 .InlineShapes(1).Select
29 End With
30 End Sub