Looping through ListParagraphs to set templates not working

corpse

Member
Joined
Dec 12, 2002
Messages
12
Location
chicago area
I have a large document that is automatically created, however the numbering style isnt getting set right...

Heres some of the code Im trying:

Code:
Dim oP As Object  Word.Paragraph
Dim x As Object  Word.ListTemplate
x = m_objWordApp.ListGalleries.Item(3).ListTemplates.I  tem(4)

Try
	For Each oP In m_objBaseDoc.listparagraphs
	    If oP.Range.ListFormat.ListType = 0 Then	  wdListNoNumbering
		    oP.Range.ListFormat.ApplyOutlineNumberDefault()
    	     End If
	    oP.Range.ListFormat.ApplyListTemplate(x, False)
	Next


The line with .ApplyListFormat is causing it to break, it says Type Mismatch on x. I am trying to enforce that the list is set with the 3rd outnline numbering method, so my items are like 1.0, 1.1.1, 1.1.2.3, etc...

While at it, Im also trying to get the lines to indent properly. When I send a vbTab it indents the text, but doesnt indent the list level.. ie: if indenting the second item, it would appear:
2.0 text
instead of
1.1 text
 
Back
Top