Hi Folks,
Am using Excel VBA macro to create a MS Word document. Seeking efficient method to reset bullet lettering in Word list back to its first value, that is, reset to “a)” prior to printing a second, or additional list.
I'm using template and styles in Word to establish desired formatting there. Also using TypeText, With WordApp.Selection.ParagraphFormat, TypeParagraph, etc. in Excel macro. All works well.
Only issue is second typing instance of bulleted list (style) in same document. Lettering in second list always continues from first list existing earlier in same document; ie, first letter in second list is h), or similar.
Tried recording a Word macro to identify critical language that might be incorporated into Excel macro, but no such luck. I think critical term is “ContinuePreviousList:= _ False” but am not certain. Am not able to implement same in Excel. One attempt is here:
[START]
With WordApp.Selection
.Style = WordApp.ActiveDocument.Styles("MyBulletTemplate")
.ContinuePreviousList = False
End With
[END]
The above results in error message: “Object doesn’t support this property or method.”
Relevant portions of the Word macro I recorded is here:
With WordApp.Selection
ListGalleries(wdNumberGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
ListGalleries(wdNumberGallery).ListTemplates(1), ContinuePreviousList:= _
False, ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _
wdWord10ListBehavior
Since my use of bullet formatting is inside a loop, repeating production of a list, the need to reset the start of the bullet lettering is multiple.
Is there a line of text that I can insert that will cause the list to reset prior to running? Any insights you can offer are appreciated.
Thanks!
Am using Excel VBA macro to create a MS Word document. Seeking efficient method to reset bullet lettering in Word list back to its first value, that is, reset to “a)” prior to printing a second, or additional list.
I'm using template and styles in Word to establish desired formatting there. Also using TypeText, With WordApp.Selection.ParagraphFormat, TypeParagraph, etc. in Excel macro. All works well.
Only issue is second typing instance of bulleted list (style) in same document. Lettering in second list always continues from first list existing earlier in same document; ie, first letter in second list is h), or similar.
Tried recording a Word macro to identify critical language that might be incorporated into Excel macro, but no such luck. I think critical term is “ContinuePreviousList:= _ False” but am not certain. Am not able to implement same in Excel. One attempt is here:
[START]
With WordApp.Selection
.Style = WordApp.ActiveDocument.Styles("MyBulletTemplate")
.ContinuePreviousList = False
End With
[END]
The above results in error message: “Object doesn’t support this property or method.”
Relevant portions of the Word macro I recorded is here:
With WordApp.Selection
ListGalleries(wdNumberGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
ListGalleries(wdNumberGallery).ListTemplates(1), ContinuePreviousList:= _
False, ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _
wdWord10ListBehavior
Since my use of bullet formatting is inside a loop, repeating production of a list, the need to reset the start of the bullet lettering is multiple.
Is there a line of text that I can insert that will cause the list to reset prior to running? Any insights you can offer are appreciated.
Thanks!