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 72,7% France
Canada 5,6% Canada
Belgique 3,7% Belgique

Total:

151

Pays
018439793
Aujourd'hui: 196
Hier: 177
Cette semaine: 1.422
Semaine dernière: 2.547
Ce mois: 9.313