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 67,8% France
Chine 7,8% Chine
États-Unis d'Amérique 4,9% États-Unis d'Amérique

Total:

178

Pays
018533171
Aujourd'hui: 198
Hier: 238
Cette semaine: 198
Semaine dernière: 2.977
Ce mois: 2.115