business_analyst
Board Regular
- Joined
- Jun 5, 2009
- Messages
- 99
Hey All,
so I am sending some text from excel to a word document. I would like to create an Outline list for this information with two levels:
1)
so I am sending some text from excel to a word document. I would like to create an Outline list for this information with two levels:
1)
a.
I know how to create a regular list, but I have no idea how to tell word to execute the second list level! This is the code I have right now:
Code:
Sub CreateNewWordDoc()
Dim wrdApp As Object
Dim wrdDoc As Object
Dim textvar As String
Set wrdApp = CreateObject("Word.Application.11")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add
With wrdApp.Selection
.Range.ListFormat.ApplyListTemplate ListTemplate:=wrdApp.ListGalleries(wdOutlineNumberGallery).ListTemplates(1), ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior
.TypeText Text:="First line with level one"
.TypeParagraph
.Range.ListFormat.RemoveNumbers NumberType:=wdNumberParagraph