Â
Cela n'est pas possible, mais voici une macro écrite par Geo qui va insérer dans la marge du document des zones de texte contenant le style du paragraphe en cours.
Â
Sub Styles_dans_doc()
'macro écrite par Geo
' Pour imposer un nom aux zones de texte
' Afin lors de l'opération de nettoyage
' ne supprimer que celles qui ont été générées
' par macro pour les noms de style.
Const Pfx As String = "MesStyles "
' Marge d'impression de l'imprimante sur la gauche
' les zones de texte sont décollée du bord du papier
' pour cette valeur (en points,
' 1 pouce = 72 points, 1 cm = 28,3 points)
Const MargeImprimante As Integer = 12
' Largeur des zônes à  ajuster selon les noms de style
Const LargeurZ As Integer = 50
Sub SupStylesInutiles()
Dim S As Style
Dim msg As String
Dim MonDoc As Document
Set MonDoc = ActiveDocument
Sub DeleteZonesTexte()
Dim i As Long
For i = ActiveDocument.Shapes.Count To 1 Step -1
If Left(ActiveDocument.Shapes(i).name, Len(Pfx)) = Pfx Then
ActiveDocument.Shapes(i).Delete
End If
Next i
End Sub
Sub AjouteNomStyle()
Dim StyleCourant As String
Dim StylePrecedent As String
Dim P As Paragraph
Dim myTBox As Shape
Dim Marge As Long
StylePrecedent = ""
StyleCourant = ""
Dim i As Long
i = 0
For Each P In ActiveDocument.Paragraphs
StyleCourant = P.Style
If StyleCourant <> StylePrecedent Then
P.Range.Select
' Selection.Collapse Direction:=wdCollapseStart
Marge = Selection.PageSetup.LeftMargin - MargeImprimante
Set myTBox = ActiveDocument.Shapes _
.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
Left:=-Marge, Top:=0, Width:=LargeurZ, _
Height:=20, Anchor:=Selection.Range)
With myTBox.TextFrame
.TextRange = StyleCourant
.TextRange.ParagraphFormat.Alignment = wdAlignParagraphCenter
.TextRange.ParagraphFormat.SpaceAfter = 0
.TextRange.ParagraphFormat.SpaceBefore = 0
.TextRange.Italic = True
.TextRange.Bold = True
.TextRange.Font.Size = 8
End With
' ajustement de la zone
myTBox.Height = myTBox.TextFrame.TextRange.Font.Size * 2
myTBox.name = Pfx & i
i = i + 1
StylePrecedent = StyleCourant
End If
Next P
End Sub





