Код: Выделить всё
Sub m_1()
Dim myRange As Range
Dim x As Long
Set myRange = ActiveDocument.TablesOfContents(1).Range
With myRange.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^t"
.Replacement.Text = ""
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
While .Execute
x = x + 1
If x Mod 2 <> 0 Then
If FormatNumber(.Parent.Characters(1).Information(wdHorizontalPositionRelativeToPage) - .Parent.PageSetup.LeftMargin, 0) + 14 <> FormatNumber(.Parent.ParagraphFormat.LeftIndent, 0) Then
vLeftIndent_1 = .Parent.ParagraphFormat.LeftIndent
vFirstLineIndent = .Parent.ParagraphFormat.FirstLineIndent
vDifference = vLeftIndent_1 + vFirstLineIndent
vLeftIndent_2 = FormatNumber(.Parent.Characters(1).Information(wdHorizontalPositionRelativeToPage) - .Parent.PageSetup.LeftMargin, 0) + 14
.Parent.ParagraphFormat.LeftIndent = vLeftIndent_2
.Parent.ParagraphFormat.FirstLineIndent = -vLeftIndent_2 + vDifference
End If
End If
Wend
End With
End Sub
Загвоздка в том, что таких знаков Табуляции 2, а мне надо учитывать только первый знак Табуляции. [ATTACH]1267[/ATTACH]