Soit une ligne contenant, sans formattage aucun, ""
Je met en route l'enregistreur de macro, pour obtenir ça:
f a c ffa
le 2e f se voit appliqué la modification "Gradient Fill, Gold, Accent 4, Outline - Accent 4", le troisième f est barré, et le dernier a est en indice.
Ni l'application de couleurs, ni celle d'effets de texte/typographie un peu flashy ne sont pris en compte par l'enregistreur de macro.
Code:
Sub Macro5()
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Bold = wdToggle
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.StrikeThrough = wdToggle
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Subscript = wdToggle
Selection.MoveLeft Unit:=wdWord, Count:=4
End Sub