How to know in which paragragh is the cursor using VBA

F

Filadelfio Contino

Hi at all,
I have a little problem to solve.
I have a range i which there is a character. How do I do
to know in which activedocument.paragraphs the range is?

Thanks in advance to anybody that can help me.

Ciao.
 
H

Helmut Weber

Hi Filadelfio,
like this:
Dim oRng As Range
Set oRng = Selection.Range.Duplicate
oRng.Start = 0
MsgBox oRng.Paragraphs.Count
Note, that a character has to be selected. If the selection
is an insertion point at the beginning of a paragraph,
then you have to add 1 to the result, unless the insertion point
is at the beginning of the doc. Not to mention other complications.
 

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