csr
Programmer
- Jul 20, 2000
- 507
I am trying to keep a group of paragraphs together when the Word document is paginated. The KeepTogether property seems to be the ticket. My plan is to define a range when I am at the beginning of my group of paragraphs, save the START property of that range, Then insert my various paragraphs while collapsing ranges periodically, then finally save the END property of the last range I am using.
Then I will redefine the range using the START and END values I have saved and utilize the oRange.Paragraphs.KeepTogether property to keep those various paragraphs together.
Unfortunately, it does not seem to work. Any insight into why that might be. I have include a skeleton of some of my code below ...
A range object has been established ...
nRangeStart = oRange.start
<Some Inserts and range collapses for a few paragraphs>
oRange = oDoc.Range()
nRangeEnd = oRange.end
oRange.Start = nRangeStart && From the initial Range
oRange.Paragraphs.KeepTogether = .t.
oRange.Collapse(wdCollapseEnd)
Don
Then I will redefine the range using the START and END values I have saved and utilize the oRange.Paragraphs.KeepTogether property to keep those various paragraphs together.
Unfortunately, it does not seem to work. Any insight into why that might be. I have include a skeleton of some of my code below ...
A range object has been established ...
nRangeStart = oRange.start
<Some Inserts and range collapses for a few paragraphs>
oRange = oDoc.Range()
nRangeEnd = oRange.end
oRange.Start = nRangeStart && From the initial Range
oRange.Paragraphs.KeepTogether = .t.
oRange.Collapse(wdCollapseEnd)
Don