Class ListGallery (Word VBA)

The class ListGallery represents a single gallery of list formats. The ListGallery object is a member of the ListGalleries collection.

Set

To use a ListGallery class variable it first needs to be instantiated, for example

Dim lgy as ListGallery
Set lgy = ListGalleries(Index:=1)

The following procedures can be used to set variables of type ListGallery: Application.ListGalleries and ListGalleries.Item

For Each

Here is an example of processing the ListGallery items in a collection.

Dim lgy As ListGallery
For Each lgy In ListGalleries
	
Next lgy

ListGalleries.Count

Returns a Long that represents the number of list galleries in the collection.

Dim lngCount As Long
lngCount = ListGalleries.Count

ListGalleries.Item

Returns an individual ListGalleries object in a collection.

Syntax : expression.Item (Index)

Index: The individual object to be returned.

Dim lgy As ListGallery
Set lgy = ListGalleries(Index:=1)

ListGalleries.Parent

Returns an object that represents the parent object of the specified ListGalleries object.

Dim objParent As Object
Set objParent = ListGalleries.Parent

ListTemplates

Returns a ListTemplates collection that represents all the list formats for the specified list gallery.

For information about returning a single member of a collection, see Returning an object from a collection. The ListTemplates property is a member of the Document, ListGallery, and Template objects.

Set mytemp = ListGalleries(wdOutlineNumberGallery).ListTemplates(1) 
For each lev in mytemp.ListLevels 
 lev.NumberStyle = wdListNumberStyleLowercaseLetter 
Next lev 
ActiveDocument.Lists(2).ApplyListTemplate ListTemplate:=mytemp

Modified

True if the specified list template is not the built-in list template for that position in the list gallery.

Use the Reset method to set a list template in a list gallery back to the built-in list template.

Syntax : expression.Modified (Index)

Parent

Returns an object that represents the parent object of the specified ListGallery object.

Dim objParent As Object
Set objParent = ListGalleries(1).Parent

Reset

Resets the list template specified by Index for the specified list gallery to the built-in list template format.

Syntax : expression.Reset (Index)

Index: The template to reset.

ListGalleries(wdNumberGallery).Reset(4) 
Selection.Range.ListFormat.ApplyListTemplate _ 
 ListTemplate:=ListGalleries(2).ListTemplates(4)