M
MT DOJ Help Desk
Word 2000
I have the following code in a test routine that I'm developing. The code
works well as is, but just as a point of curiosity, I am wondering if it is
possible to insert a page break after the current selection, so that I can
do away with the Selection.Collapse (Down) command. I know there is a
Selection.InsertAfter command, but I was not able to get that to work in
conjunction with InsertBreak. Is there a way to rewrite the
Selection.InsertBreak command so that it inserts the page break AFTER the
current selection?
Sub TestInsertPageBreaks()
Counter = 0
For Each oBookmark In ActiveDocument.Range.Bookmarks
Counter = Counter + 1
BookmarkName = ActiveDocument.Range.Bookmarks(Counter)
If Left(BookmarkName, 6) = "Record" Then
Selection.GoTo what:=wdGoToBookmark, Name:=BookmarkName
Selection.Collapse (Down)
Selection.InsertBreak Type:=wdPageBreak
End If
Next oBookmark
End Sub
-- Tom
MT DOJ Help Desk
Making the world a safer place.
I have the following code in a test routine that I'm developing. The code
works well as is, but just as a point of curiosity, I am wondering if it is
possible to insert a page break after the current selection, so that I can
do away with the Selection.Collapse (Down) command. I know there is a
Selection.InsertAfter command, but I was not able to get that to work in
conjunction with InsertBreak. Is there a way to rewrite the
Selection.InsertBreak command so that it inserts the page break AFTER the
current selection?
Sub TestInsertPageBreaks()
Counter = 0
For Each oBookmark In ActiveDocument.Range.Bookmarks
Counter = Counter + 1
BookmarkName = ActiveDocument.Range.Bookmarks(Counter)
If Left(BookmarkName, 6) = "Record" Then
Selection.GoTo what:=wdGoToBookmark, Name:=BookmarkName
Selection.Collapse (Down)
Selection.InsertBreak Type:=wdPageBreak
End If
Next oBookmark
End Sub
-- Tom
MT DOJ Help Desk
Making the world a safer place.