Mijn vraag :
Enkele jaren geleden heb ik van iemand een VBA code gekregen om automatisch het aantal letters in haakjes vóór een betreffend woord te plaatsen.
Werkt goed : ik klik op een woord, en met een bepaalde toetscombinatie komt dus het aantal letters mooi tussen haakjes voor dat woord.
Nu is het zo dat de "ij" als 2 letters geteld wordt, terwijl ik dit als 1 letter wil laten tellen.
Weet iemand hoe ik die code aan kan passen ? Of evt. een stukje code kan toevoegen ( en zo ja, waar dan precies ? ; zelf heb ik hier helemaal geen verstand van ) om dit voor elkaar te krijgen ?
Volgens mij kan ik hier geen bijlage meesturen, daarom hieronder de betreffende code :
Sub ZetLengte()
Dim wd As Range
Dim iStart As Long
Dim strLen As String
Dim rng As Range
Application.ScreenUpdating = False
With Selection
For Each wd In .Words
If Left(wd.Text, 1) Like "[a-zA-Z]" Then
strLen = Len(wd) + 1 * (Right(wd, 1) = " ")
iStart = wd.Start - Len(strLen) - 3
If iStart >= 0 Then
FontProp wd.Start - 1, wd.Start
If ActiveDocument.Range(iStart, iStart + Len(strLen) + 3).Text <> "(" & strLen & ") " Then
wd.InsertBefore "(" & strLen & ") "
End If
Else
wd.InsertBefore "(" & strLen & ") "
FontProp 0, Len(strLen) + 3
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Sub FontProp(iFrom As Long, iTo As Long)
With ActiveDocument.Range(iFrom, iTo).Font
If .Bold Then .Bold = False
If .Italic Then .Italic = False
If .Underline Then .Underline = wdUnderlineNone
If .DoubleStrikeThrough Then .DoubleStrikeThrough = False
If .StrikeThrough Then .StrikeThrough = False
If .ColorIndex <> wdBlue Then .ColorIndex = wdBlue
End With
End Sub
Alvast bedankt voor de eventuele hulp !
Relevante software en hardware die ik gebruik
Windows 10, word 2013
Enkele jaren geleden heb ik van iemand een VBA code gekregen om automatisch het aantal letters in haakjes vóór een betreffend woord te plaatsen.
Werkt goed : ik klik op een woord, en met een bepaalde toetscombinatie komt dus het aantal letters mooi tussen haakjes voor dat woord.
Nu is het zo dat de "ij" als 2 letters geteld wordt, terwijl ik dit als 1 letter wil laten tellen.
Weet iemand hoe ik die code aan kan passen ? Of evt. een stukje code kan toevoegen ( en zo ja, waar dan precies ? ; zelf heb ik hier helemaal geen verstand van ) om dit voor elkaar te krijgen ?
Volgens mij kan ik hier geen bijlage meesturen, daarom hieronder de betreffende code :
Sub ZetLengte()
Dim wd As Range
Dim iStart As Long
Dim strLen As String
Dim rng As Range
Application.ScreenUpdating = False
With Selection
For Each wd In .Words
If Left(wd.Text, 1) Like "[a-zA-Z]" Then
strLen = Len(wd) + 1 * (Right(wd, 1) = " ")
iStart = wd.Start - Len(strLen) - 3
If iStart >= 0 Then
FontProp wd.Start - 1, wd.Start
If ActiveDocument.Range(iStart, iStart + Len(strLen) + 3).Text <> "(" & strLen & ") " Then
wd.InsertBefore "(" & strLen & ") "
End If
Else
wd.InsertBefore "(" & strLen & ") "
FontProp 0, Len(strLen) + 3
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Sub FontProp(iFrom As Long, iTo As Long)
With ActiveDocument.Range(iFrom, iTo).Font
If .Bold Then .Bold = False
If .Italic Then .Italic = False
If .Underline Then .Underline = wdUnderlineNone
If .DoubleStrikeThrough Then .DoubleStrikeThrough = False
If .StrikeThrough Then .StrikeThrough = False
If .ColorIndex <> wdBlue Then .ColorIndex = wdBlue
End With
End Sub
Alvast bedankt voor de eventuele hulp !
Relevante software en hardware die ik gebruik
Windows 10, word 2013