Finding if a Style has numbering

K

Ken

I have a style object and I want to find if it has bullets or numbering
and the format of the bullet or number.
With ActiveDocument.Styles(n)
..ListLevelNumber works OK
..Type works OK
..ListTemplate gives an error message that the property is not
supported even though the Object Browser shows it as a property of the
Styles object.
How do I get the info I want?
 
S

Stefan Blom

The ListTemplate property is of type ListTemplate class. However, if
the style is not attached to a ListTemplate, the property has the
initial value NOTHING (which simply means an "empty" object
reference). You can use the Is operator to determine if an object is
NOTHING:

Dim x As Boolean
x = ActiveDocument.Styles("style_name_here") _
.ListTemplate Is Nothing

If x is False, the style is attached to numbering.

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
J

Jezebel

ListTemplate is an object, not a simple variable. You need to test whether
it is present as such --

With activedocument.styles(n)
if not .listtemplate is nothing then ...
 
K

Ken

Ken said:
Thanks Guys

Mayby I spoke too soon! "if not .listtemplate is nothing then.." works
fine for almost all styles except that I came accross a style in a
document then crashed Word at this statement - error trapping did not
work. I picked the style's parameters to bits and could not see
anything unusual and I was forced to delete the style and re-create.
Another style also gave trouble but error trapping worked.

It looks as though there are lots of bugs around lists.
 

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