View Single Post
 
Old 01-30-2019, 12:28 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

Quote:
Originally Posted by Guessed View Post
to find out what ASCII code number is required to identify your bullets, select one of them and then run the following code in the VBA Immediate Window

Thanks Andrew. Most helpful! After spending 10 minutes figuring out how to pull up the "Immediate window" (🤦*♂️), I was able to figure out the ASCII code: 77.

Unfortunately, even with this modification (and deleting the space before and after the bullet - good tip!), my code still doesn't work. Here is the cleaned up code:

Quote:
Sub TopiaFormat()
'
' TopiaFormat Macro
'

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(77) & vbTab
End With
End If
End With
Next

With Selection.Find
.ClearFormatting
.Text = "Chr(77)"
.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

ActiveDocument.Select
Selection.ClearFormatting

End Sub
The bullets disappear (good!), but there is no replacement (bad!).

In the "Customize Bulleted list" pane, my bullets are set to Indent at 0.63 cm, with a text position indented at 1.34 cm. Could this have something to do with it?

Thanks again for your help.
Attached Images
File Type: png Screen Shot 2019-01-30 at 09.11.17.png (7.6 KB, 22 views)
Reply With Quote