View Full Version : Find and Replace a bullet followed by a space
jbuggs55555
09-16-2014, 08:15 AM
Hi -
I am attempting to find and replace all bullets followed by a paragraph marker or empty string. In the example below, I need to keep line one and two, but need to replace line 3 with an empty string and no bullet. I had to type empty string or else the bullet wouldn't display in the post. Any thoughts? Thanks!
Example
Line One
Line Two
(Empty String)
gmayor
09-16-2014, 10:48 PM
If these are automatically created bullets using the bullet function in Word, then the following should work
Dim oPara As Word.Paragraph
For Each oPara In ActiveDocument.Paragraphs
If oPara.Range.ListFormat.ListType = _
WdListType.wdListBullet Then
If Len(oPara.Range) = 1 Then oPara.Range.Delete
End If
Next
or if you want to leave an empty paragraph without a bullet
Dim oPara As Word.Paragraph
For Each oPara In ActiveDocument.Paragraphs
If oPara.Range.ListFormat.ListType = _
WdListType.wdListBullet Then
If Len(oPara.Range) = 1 Then oPara.Range.ListFormat.RemoveNumbers _
NumberType:=wdNumberParagraph
End If
Next
jbuggs55555
09-17-2014, 10:36 AM
If these are automatically created bullets using the bullet function in Word, then the following should work
Dim oPara As Word.Paragraph
For Each oPara In ActiveDocument.Paragraphs
If oPara.Range.ListFormat.ListType = _
WdListType.wdListBullet Then
If Len(oPara.Range) = 1 Then oPara.Range.Delete
End If
Next
or if you want to leave an empty paragraph without a bullet
Dim oPara As Word.Paragraph
For Each oPara In ActiveDocument.Paragraphs
If oPara.Range.ListFormat.ListType = _
WdListType.wdListBullet Then
If Len(oPara.Range) = 1 Then oPara.Range.ListFormat.RemoveNumbers _
NumberType:=wdNumberParagraph
End If
Next
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.