In WordBasic, I moved to the end of the document, then deleted
the last character -- which took out 1 trailing section break.
Using the Word application object model, the code has become so
complex that I'm never sure what I've got at the end of the document,
so I'm quite happy to have more explicit code with testing.
It's interesting to compare the two examples:
last section:
.Sections.Last.Range
.Sections(.Sections.Count).Range
delete:
selection.Delete
.Range(pRange.Start - 1, pRange.End).Delete
My preference is to go with Range rather than Select, even
though this makes the code less intuitive, because I have
an idea that Select implies use of the GUI, and might work
differently if the application was hidden and not activated.
..Last. /looks/ better than .Section.Count Jezebel, is this just
coding practice or am I missing something?
Question: is a Paragraph Mark the same as a lf/cr? or is there
a different test for that?
(david)
Jezebel said:
Hardly a problem, just a matter of your definition of 'blank'. Mine was a
maximum of one character (presumptively a paragraph mark) plus any number of
spaces. But you could be a lot more sophisticated with your test, eg
If pRange.Text Like "[ " & vbcr & vblf & "]*" then
DA said:
Hi Jezebel,
Problem with this is that you're taking for granted that
the final section has a single character. What about if
your blank sections have 2 or more carriage returns -
linefeeds - or both?
I couldn't get my brain into gear this morning, got any
other ideas on how we can cover the above (apart from
that rather ugly looking if statement I posted earlier)?
Dennis.