Reputation: 580
I'm trying to remove all the bullets in a Word 2007 document. It is a very big document so I tried to solve this using a macro. I have no experience in office suite or in VBA scripting so I'm a bit disoriented..
I have tried different solutions I found on internet, the best I found was a script that applied a new template on lists, it was something like this:
Sub ReplaceBullets()
Dim oPara As Paragraph
For Each oPara In ActiveDocument.Paragraphs()
Set r = oPara.Range
If r.ListFormat.ListType = wdListBullet Then
r.ListFormat.ApplyListTemplate _
ListTemplate:=ListGalleries(wdNumberGallery) _
.ListTemplates(1)
End If
Set r = Nothing
Next
End Sub
But I saw from the documentation that the range from wich I can choose in "ListTemplates" goes from 1 to 7, excluding "none", which I need.
I've also tried using "r.ListFormat.ApplyBulletDefault" method instead of changing list template, hoping that the default style would be "none". Obviously it works only if the default style for the document is "none". I tried to understand how to obtain the document default bullet style and to change it but with no luck..
I hope someone can give me some good advice..
Thank you :)
Upvotes: 3
Views: 5602
Reputation: 19067
If you want to remove bullets and convert it into no bullet, no list paragraph, just simply a text, this line will do the trick (inside your if statement
):
r.ListFormat.RemoveNumbers
Upvotes: 4