Recherche

Voici une macro qui va créer un nouveau document dans lequel seront listées toutes les expressions entre parenthèses situées dans le document actif.

 

Sub parentheses2()

'macro écrite par m@rina
Dim texte As String, Liste As String, ND As Document

Application.ScreenUpdating = False
Selection.HomeKey unit:=wdStory

'Recherche de tous les textes entre parenthèses
    Do
        Selection.Find.ClearFormatting
        With Selection.Find
            .ClearFormatting
            .Text = "\(*\)"
            .Forward = True
            .Wrap = wdFindStop
            .MatchCase = True
            .MatchWildcards = True
            .Execute
        End With

    If Selection.Find.Found Then
        texte = ActiveDocument.Range(Selection.Range.Start + 1, Selection.Range.End - 1)
            If InStr(Liste, texte) = 0 Then
                Liste = Liste & texte & vbCr
            End If
        End If
    Loop Until Not Selection.Find.Found

'On crée le nouveau doc et on y insère les textes trouvés
    Set ND = Documents.Add
    Selection.TypeText Text:=Liste

End Sub

Statistiques

France 68,4% France
Chine 7,6% Chine
Canada 4,7% Canada

Total:

169

Pays
018527753
Aujourd'hui: 486
Hier: 270
Cette semaine: 486
Semaine dernière: 2.616
Ce mois: 9.124