Добрый вечер.
[vba]Код
Private Sub CommandButton1_Click()
Dim var As Variant, sel As Range, s%
Set sel = Selection.Range
Application.ScreenUpdating = False
s = ActiveDocument.Windows(1).VerticalPercentScrolled
For Each var In Array("Текст1", "ТекстМ2", "Текст3К")
With Selection.Find
.ClearFormatting
.Wrap = wdFindContinue
.Text = var
.Execute
Do
Selection.Collapse wdCollapseEnd
Selection.Range.Paragraphs(1).Style = ActiveDocument.Styles(-2)
.Execute
Loop Until Not .Found
End With
Next
sel.Select
ActiveDocument.Windows(1).VerticalPercentScrolled = s
Application.ScreenUpdating = True
End Sub
[/vba]
в части кода [vba]Код
ActiveDocument.Styles(-2)
[/vba] -2=-1-УровеньЗаголовка