D
DJ
Hello Group!
I'm trying to write a subroutine that will examine the first several
characters of each line in a Word document and take some action based on the
value. I'm having difficulty with coding a loop that will cycle through each
line until it reaches the end of the document.
I'm fairly new to vba and was wondering if someone could explain why the
following code doesn't reach the end sub when the cursor is at the end of
the document:
Sub AutoExport()
Selection.HomeKey Unit:=wdStory
Selection.HomeKey Unit:=wdLine
Do Until ActiveDocument.Bookmarks("\Sel") = _
ActiveDocument.Bookmarks("\EndOfDoc")
Selection.MoveDown
Loop
End Sub
Many thanks!
~ Dave
I'm trying to write a subroutine that will examine the first several
characters of each line in a Word document and take some action based on the
value. I'm having difficulty with coding a loop that will cycle through each
line until it reaches the end of the document.
I'm fairly new to vba and was wondering if someone could explain why the
following code doesn't reach the end sub when the cursor is at the end of
the document:
Sub AutoExport()
Selection.HomeKey Unit:=wdStory
Selection.HomeKey Unit:=wdLine
Do Until ActiveDocument.Bookmarks("\Sel") = _
ActiveDocument.Bookmarks("\EndOfDoc")
Selection.MoveDown
Loop
End Sub
Many thanks!
~ Dave