View Single Post
 
Old 06-21-2011, 01:45 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,514
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Sickorax,

I don't have Word 2007 installed any more - I'm now using Word 2010. In that app, the window split in draft mode doesn't change. That said, here's some macros that might help with your work. Basically, they allow you to quickly navigate forward or backwards for other occurrences of the currently-selected string. Simply assign NavigateNext and NavigatePrev to the Alt-N and Alt-P key combinations, respectively, and you're in business!
Code:
Sub NavigateNext()
Dim StrFnd As String, bDirection As Boolean
StrFnd = Trim(Selection.Text)
If StrFnd = vbNullString Then
  MsgBox "No Text Selected: Please select a find string!", vbOKOnly, "Navigation Error"
  Exit Sub
End If
If Len(StrFnd) > 256 Then StrFnd = Left(StrFnd, 256)
Selection.Collapse wdCollapseEnd
bDirection = True
Call Navigator(StrFnd, bDirection)
End Sub
 
Sub NavigatePrev()
Dim StrFnd As String, bDirection As Boolean
StrFnd = Trim(Selection.Text)
If StrFnd = vbNullString Then
  MsgBox "No Text Selected: Please select a find string!", vbOKOnly, "Navigation Error"
  Exit Sub
End If
If Len(StrFnd) > 256 Then StrFnd = Left(StrFnd, 256)
Selection.Collapse wdCollapseStart
bDirection = False
Call Navigator(StrFnd, bDirection)
End Sub
 
Sub Navigator(StrFnd As String, bDirection As Boolean)
With Selection.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Replacement.Text = vbNullString
  .Text = StrFnd
  .Forward = bDirection
  .Wrap = wdFindStop
  .Format = False
  .MatchAllWordForms = False
  .MatchSoundsLike = False
  .MatchWildcards = False
  .Execute
  If .Found = False Then
    MsgBox Chr(34) & StrFnd & Chr(34) & " not found", vbExclamation
  End If
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote