Visual Basic - Párrafo muy largo VBA en Word

Life is soft - evento anual de software empresarial
 
Vista:

Párrafo muy largo VBA en Word

Publicado por Pablo G. (1 intervención) el 29/04/2020 17:35:49
Es posible hacer algo así con párrafos, para determinar si un párrafo es muy largo, ya sea por el número de caracteres, palabras, líneas u oraciones que contenga:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Sub Mark_Long()
    Dim iMyCount As Integer
    Dim iWords As Integer
 
    If Not ActiveDocument.Saved Then
        ActiveDocument.Save
    End If
 
    'Reset counter
    iMyCount = 0
 
    'Set number of words
    iWords = 20
 
    For Each MySent In ActiveDocument.Sentences
        If MySent.Words.Count > iWords Then
            MySent.Font.Color = wdColorRed
            iMyCount = iMyCount + 1
        End If
    Next
    MsgBox iMyCount & " sentences longer than " & _
      iWords & " words."
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder