View Single Post
 
Old 01-26-2025, 08:14 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Another way:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range
Application.CheckLanguage = True
With Selection
  Set Rng = .Range
  .LanguageID = wdFrenchCanadian
  .NoProofing = False
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "<[JFMASOND][abceglnoprtuvy]{2} [0-9]{1;2}, [0-9]{2}>"
      .Replacement.Text = ""
      .MatchWildcards = True
      .Wrap = wdFindStop
      .Forward = True
      .Format = False
    End With
    Do While .Find.Execute
      If .InRange(Rng) Then
        Select Case Split(.Text, " ")(0)
          Case "Jan": .Text = Split(Split(.Text, " ")(1), ",")(0) & " janv. 20" & Split(.Text, " ")(2)
          Case "Feb": .Text = Split(Split(.Text, " ")(1), ",")(0) & " févr. 20" & Split(.Text, " ")(2)
          Case "Mar": .Text = Split(Split(.Text, " ")(1), ",")(0) & " mars 20" & Split(.Text, " ")(2)
          Case "Apr": .Text = Split(Split(.Text, " ")(1), ",")(0) & " avr. 20" & Split(.Text, " ")(2)
          Case "May": .Text = Split(Split(.Text, " ")(1), ",")(0) & " mai 20" & Split(.Text, " ")(2)
          Case "Jun": .Text = Split(Split(.Text, " ")(1), ",")(0) & " juin 20" & Split(.Text, " ")(2)
          Case "Jul": .Text = Split(Split(.Text, " ")(1), ",")(0) & " juill. 20" & Split(.Text, " ")(2)
          Case "Aug": .Text = Split(Split(.Text, " ")(1), ",")(0) & " août 20" & Split(.Text, " ")(2)
          Case "Sep": .Text = Split(Split(.Text, " ")(1), ",")(0) & " sept. 20" & Split(.Text, " ")(2)
          Case "Oct": .Text = Split(Split(.Text, " ")(1), ",")(0) & " oct. 20" & Split(.Text, " ")(2)
          Case "Nov": .Text = Split(Split(.Text, " ")(1), ",")(0) & " nov. 20" & Split(.Text, " ")(2)
          Case "Dec": .Text = Split(Split(.Text, " ")(1), ",")(0) & " déc. 20" & Split(.Text, " ")(2)
        End Select
        .Font.Color = 16711937 'Blue HTML 1/1/255
      Else
        Exit Do
      End If
      .Collapse wdCollapseEnd
    Loop
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote