How to reference a given paragraph in the ActiveDocument.Paragraphs collection?

K

keith brickey

How can I reference a given paragrah as a member of
ActiveDocuments.Paragraphs? In other words I need to know the Index that
would point to ActiveDocuments.Paragraphs(Index) for a paragraph object
named para.

Thanks,

Keith
 
J

Jay Freedman

How can I reference a given paragrah as a member of
ActiveDocuments.Paragraphs? In other words I need to know the Index that
would point to ActiveDocuments.Paragraphs(Index) for a paragraph object
named para.

Thanks,

Keith

Hi Keith,

If the selection (cursor) is in that paragraph, then the expression
you want is Selection.Paragraphs(1) -- that is, it's the first
paragraph in the selection, and it doesn't usually matter what its
index is within the ActiveDocument. The same principle is true for any
collection, and it's also true for references using a Range object
instead of the Selection.

For the few times you really need the absolute index within the
ActiveDocument, see
http://word.mvps.org/FAQs/MacrosVBA/GetIndexNoOfPara.htm.
 

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