![]() |
|
|
|
#1
|
|||
|
|||
|
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
|
|
#2
|
|||
|
|||
|
thanks for the script, ill tweak it and see if I can use it....
I figured I could loop "lines" and then do what i want with them since there are some basic functions Word provides that deal with lines, (line numbering) i am working on parsing text within Word for the internet so creating a cleanup program based on my personal needs (i have seen many clean up macros out there, they are great but dont fit for my needs) so i would like to isolate some "lines" that contain certain objects or formatting that I cant isolate with looping each "sentence". Could I loop each "line-breaks"? this is 1 example. I parsed sentences and this is the last word of the sentence and ended up in its own line. When I looked into it, it contains these 2 symbols. What are they whats their meaning in Word? (pic enclosed) |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Loop through Word doc to find and reformat text
|
Sandy27 | Word VBA | 5 | 01-06-2014 03:48 PM |
Loop action in Word until not found
|
kilburfi | Word VBA | 2 | 07-12-2013 01:26 AM |
How to a For loop in VBA
|
Jennifer Murphy | Word VBA | 1 | 01-29-2013 03:30 AM |
Macro to loop in Word
|
Yamaha Rider | Word VBA | 2 | 02-07-2012 05:33 PM |
WORD Macro - import picture - resize - position - page break - loop
|
Nano07 | Word VBA | 2 | 11-02-2011 05:14 AM |