View Single Post
 
Old 01-29-2019, 07:37 AM
mroatman mroatman is offline Mac OS X Office 2019
Novice
 
Join Date: Jan 2019
Location: Tallinn, Estonia
Posts: 9
mroatman is on a distinguished road
Default

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
Attached Files
File Type: docx test document.docx (43.0 KB, 9 views)

Last edited by mroatman; 01-30-2019 at 12:39 AM.
Reply With Quote