B
B
BranchInCode2019-10-05 01:47:57
Visual Basic
BranchInCode, 2019-10-05 01:47:57

How to edit paragraphs?

Help complete the 2nd item of the assignment, because. Item 1 seems to be completed (code below).
Task:
Write a macro (computer) for formatting text according to the following criteria:
1. Select all words in the text that begin with the given characters (for example: "computer") in red italics.
2. Those paragraphs in which these words are encountered should be formatted as follows: indent - 1.6 cm; line spacing is single.

Sub Task()
Dim s
  With ActiveDocument.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.Font.Italic = True
    .Replacement.Font.Color = wdColorRed
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    For Each s In Split("компьютер")
      .Execute s, Replace:=wdReplaceAll
    Next
  End With
End Sub

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question