Not that I know of, but I'm not using the latest version of Word. Have
you checked with Word VBA Help for your version?

Signature
Stefan Blom
> Thanks Stefan,
>
[quoted text clipped - 28 lines]
> > >
> > > I'm just not sure of the syntax...
For the two specific collections Bookmarks and Tasks, there's an Exists()
function (look it up in the VBA help). For all other collections, either you
iterate through the collection as Stefan said, or you can try to use the
style and catch the error if it doesn't exist, something like this:
Sub foo()
On Error Resume Next
Selection.Paragraphs(1).Style = _
ActiveDocument.Styles("foobar")
If Err.Number <> 0 Then
If Err.Number = 5941 Then ' not exist
' let VBA handle any further errors
On Error GoTo 0
Selection.Paragraphs(1).Style = _
ActiveDocument.Styles("Body Text")
Else ' other error
MsgBox Err.Description
Exit Sub
End If
End If
' let VBA handle any further errors
On Error GoTo 0
' more code...
End Sub
Personally, I prefer the iteration method. It's quick enough that it won't
slow the macro noticeably. In contrast, error handling like the above can be
hard to get right.

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
> Thanks Stefan,
>
[quoted text clipped - 31 lines]
>>>
>>> I'm just not sure of the syntax...
jimi_hendricks - 10 Mar 2005 16:29 GMT
thanks stefan, thanks jay.
I have implemented the iteration method now.
My intention is to have a seperate .dot file for each of any number of
users, and each .dot file will store a single style to be loaded in for an
individual. The template should never be manipulated directly, only used as a
place to save the style, for that reason there should never be too many
styles to iterate through, just the built-in ones and 'foobar' :-)
incidentally, there must be a reason why some collections have an 'exists()'
method, but others don't... are these things just a matter of developer
demand or is there an explicit reason why the styles collection has no
'exists()' method?
thanks
> For the two specific collections Bookmarks and Tasks, there's an Exists()
> function (look it up in the VBA help). For all other collections, either you
[quoted text clipped - 62 lines]
> >>>
> >>> I'm just not sure of the syntax...
Jay Freedman - 10 Mar 2005 16:48 GMT
If there's a reason for not having .Exists() for other collections, MS
haven't shared it with us mere mortals. I consider it a minor miracle that
any built-in collection in VBA has it. I've never noticed that "developer
demand" -- including that from MVPs -- has much to do with what gets into
VBA.
If you ever get around to writing your own collection classes, it's
certainly worth including a .Exists method for them.

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
> thanks stefan, thanks jay.
>
[quoted text clipped - 87 lines]
>>>>>
>>>>> I'm just not sure of the syntax...