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.
 
Top