View Single Post
 
Old 02-12-2014, 08:12 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I'm not intending to dispute Paul's reply. Word doesn't really work with lines.

There are however some methods and properties associated with the activewindow object that you might use. For example, using the following code, you can scroll through a document one line at a time:

Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private bStop As Boolean
Sub StopScroll()
bStop = True
End Sub
Sub StartScroll()
Dim i As Long
Dim oPage As Page
Dim j As Long
Dim oRng As Word.Range
  bStop = False
  For Each oPage In ActiveDocument.ActiveWindow.ActivePane.Pages
    For i = 1 To oPage.Rectangles(1).Lines.Count
      j = oPage.Rectangles(1).Lines(i).Range.HighlightColorIndex
      oPage.Rectangles(1).Lines(i).Range.Select
      Set oRng = Selection.Range
      Selection.Collapse wdCollapseEnd
      oRng.HighlightColorIndex = wdYellow
      Doze 200 '= 1 second
      DoEvents
      ActiveDocument.ActiveWindow.SmallScroll Down:=1 'one line
      oRng.HighlightColorIndex = j
      Application.ScreenRefresh
      If bStop Then GoTo lbl_Exit
    Next i
  Next oPage
lbl_Exit:
  Exit Sub
End Sub
Sub Doze(ByVal lngPeriod As Long)
    DoEvents
    Sleep lngPeriod
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote