Looping through ListParagraphs to set templates not working

corpse

New member
Joined
Jun 6, 2005
Messages
3
Programming Experience
5-10
I have a large document that is automatically created, however the numbering style isn't getting set right...

Here's some of the code I'm trying:
VB.NET:
		Dim oP As Object ' Word.Paragraph
		Dim x As Object ' Word.ListTemplate
		x = m_objWordApp.ListGalleries.Item(3).ListTemplates.Item(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, I'm also trying to get the lines to indent properly. When I send a vbTab it indents the text, but doesn't indent the list level.. ie: if indenting the second item, it would appear:
2.0 text
instead of
1.1 text
 
Back
Top