Thanks to both posters in
this thread, it has helped me tremendously. I am still stuck on replacing bullets, however.
Like the OP, I want to replace bullets with text. In my case, bullets should appear as[*] (including brackets).
My code and test document are attached. Any ideas what I've done wrong? I guess Chr(149) is not the right character, but I can't identify the correct one.
Quote:
ActiveDocument.Select
Selection.ClearFormatting
Dim Para As Paragraph, Rng As Range
For Each Para In ActiveDocument.Range.Paragraphs
With Para.Range
If .Text Like "?" & vbTab & "*" Then
Set Rng = .Duplicate
With Rng
.End = .Start + 2
.Text = vbNullString
.InsertBefore Chr(149) & vbTab
End With
End If
End With
Next
With Selection.Find
.ClearFormatting
.Text = " Chr(149) "
.Replacement.ClearFormatting
.Replacement.Text = "[*] "
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Dim HLnk As Hyperlink
For Each HLnk In ActiveDocument.Hyperlinks
HLnk.Range.InsertAfter "]"
Next
For Each HLnk In ActiveDocument.Hyperlinks
HLnk.Range.InsertBefore "[>" & HLnk.Address & "|"
Next
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldHyperlink Then
oField.Unlink
End If
Next
Set oField = Nothing
|