In versie 2 van de tool worden er twee macromodules toegevoegd aan Word (als je beveiligingsniveau het toelaat tenminste - zie bij de 'release notes' op het tabblad 'Downloads'). Daar zit onder andere een macro voor cijferomzettingen bij. Er zijn namelijk een aantal regels die bepalen dat je cijfers zoveel mogelijk voluit moet schrijven.

Als de macro's met succes toegevoegd werden, dan is de sneltoetscombinatie Ctrl-Shift-Alt-C toegekend aan de cijferomzetting. Selecteer een stuk(je) tekst waar een cijfer in voorkomt (bv. '19') en druk op Ctrl-Shift-Alt-C. De macro schrijft het getal voluit.

Om deze macro zelf te maken:
  • Open Word
  • Druk op Ctrl-F11 om de macro-editor te openen
  • Voeg eventueel nog een nieuwe macromodule toe
  • Plak de onderstaande tekst in de macromodule
  • Wijs een sneltoetscombinatie toe aan de macro (bv. Ctrl-Alt-Shift-C)

Sub CijfersOmzetten()
    ' Als de selectie eindigt met een regeleinde zetten de Replace-statements er telkens een regeleinde bij.
    ' In zo'n geval verkleinen we dus de selectie.
    If (Right(Selection.Text, 1) = Chr(10) Or Right(Selection.Text, 1) = Chr(13)) Then
        Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    End If
    
    Selection.Text = Replace(Selection.Text, "maal", "keer")
    ' OPM: duizendmaal, duizend maal => duizend keer
    ' Dubbele spaties verwijderen helpt niet, want het kan zijn dat alleen 'maal' geselecteerd is
    ' en dat de dubbele spatie dus niet mee in de selectie zit.
    
    Selection.Text = Replace(Selection.Text, "20x", "twintig keer")
    Selection.Text = Replace(Selection.Text, "19x", "negentien keer")
    Selection.Text = Replace(Selection.Text, "18x", "achttien keer")
    Selection.Text = Replace(Selection.Text, "17x", "zeventien keer")
    Selection.Text = Replace(Selection.Text, "16x", "zestien keer")
    Selection.Text = Replace(Selection.Text, "15x", "vijftien keer")
    Selection.Text = Replace(Selection.Text, "14x", "veertien keer")
    Selection.Text = Replace(Selection.Text, "13x", "dertien keer")
    Selection.Text = Replace(Selection.Text, "12x", "twaalf keer")
    Selection.Text = Replace(Selection.Text, "11x", "elf keer")
    Selection.Text = Replace(Selection.Text, "10x", "tien keer")
    Selection.Text = Replace(Selection.Text, "9x", "negen keer")
    Selection.Text = Replace(Selection.Text, "8x", "acht keer")
    Selection.Text = Replace(Selection.Text, "7x", "zeven keer")
    Selection.Text = Replace(Selection.Text, "6x", "zes keer")
    Selection.Text = Replace(Selection.Text, "5x", "vijf keer")
    Selection.Text = Replace(Selection.Text, "4x", "vier keer")
    Selection.Text = Replace(Selection.Text, "3x", "drie keer")
    Selection.Text = Replace(Selection.Text, "2x", "twee keer")
    Selection.Text = Replace(Selection.Text, "1x", "een keer")
    
    Selection.Text = Replace(Selection.Text, "20e", "twintigste")
    Selection.Text = Replace(Selection.Text, "19e", "negentiende")
    Selection.Text = Replace(Selection.Text, "18e", "achttiende")
    Selection.Text = Replace(Selection.Text, "17e", "zeventiende")
    Selection.Text = Replace(Selection.Text, "16e", "zestiende")
    Selection.Text = Replace(Selection.Text, "15e", "vijftiende")
    Selection.Text = Replace(Selection.Text, "14e", "veertiende")
    Selection.Text = Replace(Selection.Text, "13e", "dertiende")
    Selection.Text = Replace(Selection.Text, "12e", "twaalfde")
    Selection.Text = Replace(Selection.Text, "11e", "elfde")
    Selection.Text = Replace(Selection.Text, "10e", "tiende")
    Selection.Text = Replace(Selection.Text, "9e", "negende")
    Selection.Text = Replace(Selection.Text, "8e", "achtste")
    Selection.Text = Replace(Selection.Text, "7e", "zevende")
    Selection.Text = Replace(Selection.Text, "6e", "zesde")
    Selection.Text = Replace(Selection.Text, "5e", "vijfde")
    Selection.Text = Replace(Selection.Text, "4e", "vierde")
    Selection.Text = Replace(Selection.Text, "3e", "derde")
    Selection.Text = Replace(Selection.Text, "2e", "tweede")
    Selection.Text = Replace(Selection.Text, "1e", "eerste")
    
    Selection.Text = Replace(Selection.Text, "3de", "derde")
    Selection.Text = Replace(Selection.Text, "1ste", "eerste")
    
    Selection.Text = Replace(Selection.Text, "100", "honderd")
    Selection.Text = Replace(Selection.Text, "90", "negentig")
    Selection.Text = Replace(Selection.Text, "80", "tachtig")
    Selection.Text = Replace(Selection.Text, "70", "zeventig")
    Selection.Text = Replace(Selection.Text, "60", "zestig")
    Selection.Text = Replace(Selection.Text, "50", "vijftig")
    Selection.Text = Replace(Selection.Text, "40", "veertig")
    Selection.Text = Replace(Selection.Text, "30", "dertig")
    
    Selection.Text = Replace(Selection.Text, "20", "twintig")
    Selection.Text = Replace(Selection.Text, "19", "negentien")
    Selection.Text = Replace(Selection.Text, "18", "achttien")
    Selection.Text = Replace(Selection.Text, "17", "zeventien")
    Selection.Text = Replace(Selection.Text, "16", "zestien")
    Selection.Text = Replace(Selection.Text, "15", "vijftien")
    Selection.Text = Replace(Selection.Text, "14", "veertien")
    Selection.Text = Replace(Selection.Text, "13", "dertien")
    Selection.Text = Replace(Selection.Text, "12", "twaalf")
    Selection.Text = Replace(Selection.Text, "11", "elf")
    Selection.Text = Replace(Selection.Text, "10", "tien")
    Selection.Text = Replace(Selection.Text, "9", "negen")
    Selection.Text = Replace(Selection.Text, "8", "acht")
    Selection.Text = Replace(Selection.Text, "7", "zeven")
    Selection.Text = Replace(Selection.Text, "6", "zes")
    Selection.Text = Replace(Selection.Text, "5", "vijf")
    Selection.Text = Replace(Selection.Text, "4", "vier")
    Selection.Text = Replace(Selection.Text, "3", "drie")
    Selection.Text = Replace(Selection.Text, "2", "twee")
    Selection.Text = Replace(Selection.Text, "1", "een")
End Sub

Last edited Jul 8, 2014 at 10:40 PM by tekstridder, version 2

Comments

No comments yet.