Att Doug. More deviant behaviour with a macro

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
 
D

Doug Robbins

Try the latest macro that I posted that was created by fellow MVP Jean-Guy
Marcil

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top