Test whether a paragraph is bulleted

R

Raphael Goubet

Hi,

I'm wondering what's the best way to test whether a paragraph is
bulleted or not, independently of its style.

Could someone help me out?

Thanks in advance.

Raphael
 
K

Klaus Linke

Hi Raphael,

For (outline) numbered lists and ListNum fields, myParagraph.Range.ListFormat.ListString should give you the bullet character if there is one.

It may be a bit difficult to differentiate between numbering and bullets (especially with non-arabic numbers).
You can use .Range.ListFormat.ListType to help you with that.

Regards,
Klaus
 
S

Stefan Blom

You have to find out whether the List property has a valid object
reference, and -- if it does -- find out what type of list it is.
Something like this should work:

If Selection.Paragraphs(1).Range.ListFormat.List Is Nothing Then
Debug.Print "No list at the first para of selection!"
Else
Debug.Print "There is a list of type " & _
Selection.Paragraphs(1).Range.ListFormat.ListType & _
" at the first para."
End If

Note that Debug.Print prints information to the Immediate Window of
the Visual Basic Editor. Use the Object browser to figure out the
values of the legal values for ListType.
 

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