Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

Finding if a Style has numbering

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken - 21 Sep 2006 07:52 GMT
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?
Stefan Blom - 21 Sep 2006 08:50 GMT
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.

Signature

Stefan Blom
Microsoft Word MVP

> I have a style object and I want to find if it has bullets or numbering
> and the format of the bullet or number.
[quoted text clipped - 5 lines]
> Styles object.
> How do I get the info I want?
Jezebel - 21 Sep 2006 08:52 GMT
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 ...

>I have a style object and I want to find if it has bullets or numbering
> and the format of the bullet or number.
[quoted text clipped - 5 lines]
> Styles object.
> How do I get the info I want?
Ken - 22 Sep 2006 00:39 GMT
Thanks Guys
Ken - 27 Sep 2006 01:34 GMT
> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.