Hello!
I created a small macro (VBA) to delete the paragraphs that contain a bullet or picture bullet.
Problem is, it takes roughly 45 minutes for a 1 MB document with 277 pages (i can see Word struggling!).
Also, if a paragraph (with bullet) has a second paragraph (this one without bullet), the routine doesn't delete that second one.
Could someone kindly give me a hint on how to improve this routine? Or maybe another method to do this in a faster fashion?
Thanks in advance!
I created a small macro (VBA) to delete the paragraphs that contain a bullet or picture bullet.
Problem is, it takes roughly 45 minutes for a 1 MB document with 277 pages (i can see Word struggling!).
Also, if a paragraph (with bullet) has a second paragraph (this one without bullet), the routine doesn't delete that second one.
Could someone kindly give me a hint on how to improve this routine? Or maybe another method to do this in a faster fashion?
Thanks in advance!
Code:
'Deletes whole text when a paragraph has a bullet
Sub DelParaTextBullet()
Dim Para As Paragraph
Dim ParaText As String
For Each Para In ActiveDocument.Content.Paragraphs
DoEvents
If Para.Range.ListFormat.ListType = wdListBullet Or _
Para.Range.ListFormat.ListType = wdListPictureBullet Then
ParaText = Trim(Para.Range.Text)
If ParaText <> Chr(13) Then
Para.Range.SetRange Para.Range.Start, Para.Range.End - 1
Para.Range.Select
Selection.MoveLeft wdCharacter, Count:=1, Extend:=wdExtend
Selection.Delete
End If
End If
Next
End Sub