Christopher Greaves

Contact Me

ON LINE STORE

ON LINE STORE

ON LINE STORE

ON LINE STORE

List Numbering in Microsoft Word

The Nature Of The Problem ; Reading List ; List Numbering Is Broken ; Terminology ; Styles ; What Have We Got Here? ; Isolating A List Template ; Manipulating List Templates ; Review Of Outline Numbered List Templates ; Locating List Templates ; Removing Named List Templates ; What About The Other Two List Galleries? ; Creating Extra List Templates ; List Templates In The Document ; Making A Fresh Start ; Purge List Gallery History ; Ferreting out List Templates ; Review Of List Templates ; An Experiment With Simple Numbered List Templates ; A Built-In Numbered Simple List ; Using Named List Templates ; Steps To Build A Named List Template ; Structures ; Assembling The Style ; Assembling A List Template ; Checking It Out ; Locating A Named List Template ; Deleting List Templates ; Paste To New Document

If you are interested in applications please visit www.VBASolutions.ca .

If you are interested in end-user macros please visit www.TorontoMacros.com .

Locating List Templates

We continue our exploration of VBA code by writing a small procedure that will allow us to visit each named List Template in a List Gallery.

Public Function lngLocateNamedListTemplate(lstG As ListGallery, Optional lngStart) As Long

lngLocateNamedListTemplate = -1 ' default result is failure

Dim lngStartingPoint As Long

If IsMissing(lngStart) Then

lngStartingPoint = 1

Else

lngStartingPoint = CLng(lngStart)

End If

Dim lng As Long

For lng = lngStartingPoint To lstG.ListTemplates.Count

If Len(lstG.ListTemplates(lng).Name) = 0 Then ' not named

Else

lngLocateNamedListTemplate = lng

Exit For

End If

Next lng

End Function

Sub TESTlngLocateNamedListTemplate()

Debug.Print lngLocateNamedListTemplate(Application.ListGalleries(wdOutlineNumberGallery))

End Sub

I run the macro to drive the procedure and see this in the immediate Window:

3

I modify my TEST macro:

Sub TESTlngLocateNamedListTemplate()

Debug.Print lngLocateNamedListTemplate(Application.ListGalleries(wdOutlineNumberGallery))

Debug.Print lngLocateNamedListTemplate(Application.ListGalleries(wdOutlineNumberGallery), 4)

End Sub

When I run the modified macro, I see the indices to the first Named List Template, and to the next Named List Template.

I used the results of my first test to prime the starting point for the second test)

3

6

These results correspond to my expectations, given the state of my system.

Removing Named List Templates

Contact Me