Paragraph selection and page breaks in VBA

N

nikkiLR

Hi,

I'm looping through the paragraphs in a document (i.e. For Each myPara In
ActiveDocument.Paragraphs) and looking at the style, length of paragraph and
a number of other things. The trouble I'm having is when two paragraphs are
separated by a page break rather than a paragraph mark: then VBA recognises
it as only one paragraph.

Is this "expected" behaviour? I assume that it's a case of my understanding
of a page break being different to Word's. And does anyone know of a
(preferably) quick and easy way to overcome this so that VBA recognises it as
two paragraphs? I could go through and insert a paragraph mark with each page
break but I wondered if there was a more elegant solution out there...

Many thanks in advance for any help.

Nikki
 
D

DaveLett

Hi Nikki,
Is it expected behavior? Well, that depends, when you write "page break" do
you mean a "manual line break" (which you insert by pressing SHIFT + ENTER)
or do you really mean a page break (which you insert by by pressing CTRL +
ENTER).
All manual line breaks give the _appearance_ of separate paragraphs, but in
the Word object model, those belong to the same paragraph.

HTH,
Dave
 
M

Manfred F

Hi nikki,
I'm looping through the paragraphs in a document (i.e. For Each myPara In
ActiveDocument.Paragraphs) and looking at the style, length of paragraph and
a number of other things. The trouble I'm having is when two paragraphs are
separated by a page break rather than a paragraph mark: then VBA recognises
it as only one paragraph.

there are also issues wiht hidden text, especially when paragraph marks are
included. Always show hidden text, when You iterate through paragraphs..

Manfred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top