D
Dave Neve
Hi
Last week Doug, we noticed some strange behaviour with a macro you gave me
when a word was repeated twice in a cell.(22 11 2004 you said 'bizarre').
I also have some unexpected behaviour when I use one of my macros first
followed by your macro.
Instead of selecting the next word, your macro jumps two words ahead (unless
there is only one word left in the cell).
Try typing ten words in a cell and then run
Sub MidLong()
Dim wordrange As Range
Set wordrange = Selection.Range
Selection.Font.Size = 10
wordrange.Font.Spacing = 5
wordrange.Font.Color = wdColorSeaGreen
Selection.Collapse Direction:=wdCollapseEnd
Selection.ExtendMode = False
Selection.Font.Reset
Call NextWordSelect
End Sub
Sub NextWordSelect()
'
' NextWordSelect Macro
' Macro créée le 21/11/2004 par Dave Neve
'
Dim i As Long, myrange As Range
Selection.Words(1).Select
For i = 1 To Selection.Cells(1).Range.Words.Count
Set myrange = Selection.Cells(1).Range.Words(i)
If i < Selection.Cells(1).Range.Words.Count - 1 And InStr(myrange,
Selection) > 0 Then
Selection.Cells(1).Range.Words(i + 1).Select
Exit For
End If
Next i
End Sub
Any ideas why these two macros can't live together in peace and harmony???
Thanks in advance
Last week Doug, we noticed some strange behaviour with a macro you gave me
when a word was repeated twice in a cell.(22 11 2004 you said 'bizarre').
I also have some unexpected behaviour when I use one of my macros first
followed by your macro.
Instead of selecting the next word, your macro jumps two words ahead (unless
there is only one word left in the cell).
Try typing ten words in a cell and then run
Sub MidLong()
Dim wordrange As Range
Set wordrange = Selection.Range
Selection.Font.Size = 10
wordrange.Font.Spacing = 5
wordrange.Font.Color = wdColorSeaGreen
Selection.Collapse Direction:=wdCollapseEnd
Selection.ExtendMode = False
Selection.Font.Reset
Call NextWordSelect
End Sub
Sub NextWordSelect()
'
' NextWordSelect Macro
' Macro créée le 21/11/2004 par Dave Neve
'
Dim i As Long, myrange As Range
Selection.Words(1).Select
For i = 1 To Selection.Cells(1).Range.Words.Count
Set myrange = Selection.Cells(1).Range.Words(i)
If i < Selection.Cells(1).Range.Words.Count - 1 And InStr(myrange,
Selection) > 0 Then
Selection.Cells(1).Range.Words(i + 1).Select
Exit For
End If
Next i
End Sub
Any ideas why these two macros can't live together in peace and harmony???
Thanks in advance