View Single Post
 
Old 01-26-2025, 05:15 PM
batman1 batman1 is offline Windows 11 Office 2013
Advanced Beginner
 
Join Date: Jan 2025
Posts: 57
batman1 is on a distinguished road
Default

As far as I understand what this is about
Code:
Sub demo()
Dim oRng As Range, months, k As Long
    If Selection.End = Selection.Start Then Exit Sub
    
    Application.ScreenUpdating = False
   
    Set oRng = Selection.Range
    
    With oRng
        Selection.LanguageID = wdFrenchCanadian
        Selection.NoProofing = False
    End With
    Application.CheckLanguage = True
    
    months = Array(Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"), _
    Array("janv.", "févr.", "mars", "avr.", "mai", "juin", "juill.", "aout", "sept.", "oct.", "nov.", "déc."))

    With oRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Replacement.Font.Color = 16711937                             'Blue HTML 1/1/255
        .MatchCase = True
        .MatchWildcards = True
        .Text = "([A-Z][a-z]{2}) ([0-9]{1;2}), ([0-9]{2})"
        .Replacement.Text = "\2 \1 20\3"
        .Execute Replace:=wdReplaceAll
        oRng.Expand wdWord
        .ClearFormatting
        .Replacement.ClearFormatting
        .Replacement.Font.Color = 16711937
        .MatchCase = True
        .MatchWildcards = False
        For k = 0 To 11
            .Text = months(0)(k)
            .Replacement.Text = months(1)(k)
            .Execute Replace:=wdReplaceAll
        Next k
    End With
    Application.ScreenUpdating = True
End Sub
Reply With Quote