How to find ListTemplate number in listgalleries object

  • Thread starter Warren Lane (MSCE, CCNA)
  • Start date
W

Warren Lane (MSCE, CCNA)

What method or vb code can I use to find the list template number in the
listgalleries object for a selected outline numbering list?

ListGalleries(wdOutlineNumberGallery).ListTemplates(??).ListLevels(1)


Warren
 
J

Jean-Guy Marcil

Warren Lane (MSCE, CCNA) was telling us:
Warren Lane (MSCE, CCNA) nous racontait que :
What method or vb code can I use to find the list template number in
the listgalleries object for a selected outline numbering list?

ListGalleries(wdOutlineNumberGallery).ListTemplates(??).ListLevels(1)

I am not sure what it is you are after exactly, but I do know that you
should stay away from ListGalleries if you plan to write decent code.
ListGalleries is very unstable an unpredictable.

If, for example, you have text like this in your document:

1. Heading One¶
1.1. Sub-Heading one¶
1.2. Sub Heading two¶
2. Heading Two¶

And that you place the cursor in the third paragraph (Sub-Heading two), then
the following code will return various bits of information:

Dim rgePara As Range

Set rgePara = Selection.Paragraphs(1).Range

With rgePara
MsgBox .ListFormat.ListLevelNumber 'Returns 2 - Outline level
MsgBox .ListFormat.ListValue 'Returns 2 - Second item in that list at
that level
MsgBox .ListFormat.ListString 'Returns 1.2. - The literal number
End With



--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
[email protected]
Word MVP site: http://www.word.mvps.org
 
Top