Recherche

 

Cette macro insère un saut de page à la fin du document et liste les signets présents dans le document sur cette nouvelle page. Il reste ensuite à imprimer la page.

Public Sub ListeSignets()
Dim Signet As Bookmark
With ActiveDocument.Content
.Collapse Direction:=wdCollapseEnd
.InsertBreak Type:=wdPageBreak
For Each Signet In ActiveDocument.Bookmarks
.InsertAfter Signet.Name & vbCr
Next Signet
End With
End Sub

 

À partir de la collection des signets on peut, par exemple, associer un commentaire à chaque signet affichant le nom du signet :

Public Sub AfficheNomSignet()
Dim varSignet As Bookmark
Application.ScreenUpdating = False
For Each varSignet In ActiveDocument.Bookmarks
ActiveDocument.Comments.Add
Range:=varSignet.Range, Text:=varSignet.Name
Next varSignet
Application.ScreenUpdating = True
End Sub

 

 

Statistiques

France 66,8% France
Chine 8,2% Chine
États-Unis d'Amérique 5,5% États-Unis d'Amérique

Total:

180

Pays
018543765
Aujourd'hui: 14
Hier: 523
Cette semaine: 1.506
Semaine dernière: 3.928
Ce mois: 14