D
Dave Neve
Hi
A few months ago sm in the group gave me a simple bit of code to change the
colour and spacing of a selected word.
I would like to expand the code slightly to take into account the length of
the word.(different lengths, different font sizes) so I added an If
statement and I now have the partial code below but it blocks on the 'next
i' line (what a surprise!!!)
VB says 'Next without for' but there is a 'For' statement so I don't know
what to do
While I am at it, I'd also like to know how you type the mathematical
operators like < which are not on the keyboard.
I am currently copying and pasting them as and when I need them but there
must be a better way?
Thanks in advance
Dim wordrange As Range, lrange As Range, i As Long, j As Long
Set wordrange = Selection.Range
j = 2
For i = 1 To wordrange.Characters.Count
Set lrange = wordrange.Characters(i)
If Selection.Words.Count <= 4 Then
lrange.Font.Size = 8
lrange.Font.Size = lrange.Font.Size + j
j = j + 2
lrange.Font.Spacing = 5
wordrange.Font.Color = wdColorTan
Next i
Else
A few months ago sm in the group gave me a simple bit of code to change the
colour and spacing of a selected word.
I would like to expand the code slightly to take into account the length of
the word.(different lengths, different font sizes) so I added an If
statement and I now have the partial code below but it blocks on the 'next
i' line (what a surprise!!!)
VB says 'Next without for' but there is a 'For' statement so I don't know
what to do
While I am at it, I'd also like to know how you type the mathematical
operators like < which are not on the keyboard.
I am currently copying and pasting them as and when I need them but there
must be a better way?
Thanks in advance
Dim wordrange As Range, lrange As Range, i As Long, j As Long
Set wordrange = Selection.Range
j = 2
For i = 1 To wordrange.Characters.Count
Set lrange = wordrange.Characters(i)
If Selection.Words.Count <= 4 Then
lrange.Font.Size = 8
lrange.Font.Size = lrange.Font.Size + j
j = j + 2
lrange.Font.Spacing = 5
wordrange.Font.Color = wdColorTan
Next i
Else