If there are no matches, you won't get the prompt to change it. However:
Sub Macro2() Dim vFindText As Variant Dim vReplaceText As Variant Dim oRng As Range Dim i As Integer, j As Integer, k As Integer, m As Integer Dim lAsk As Long Const strFontName As String = "Times New Roman" 'The font to search vFindText = Array(Chr(176), Chr(177)) vReplaceText = Array(-3920, -3919) j = 0: k = 0: m = 0 For i = 0 To UBound(vFindText) Set oRng = ActiveDocument.Range With oRng.Find .Text = vFindText(i) .Font.Name = strFontName Do While .Execute j = j + 1 oRng.Select lAsk = MsgBox("Replace Symbol", vbYesNoCancel) If lAsk = 2 Then GoTo lbl_Exit If lAsk = 6 Then k = k + 1 oRng.InsertSymbol Font:="Symbol", _ CharacterNumber:=vReplaceText(i), _ Unicode:=True Else m = m + 1 End If oRng.Collapse 0 Loop End With Next i lbl_Exit: If j = 0 Then MsgBox "There are no matches", vbInformation If k > 0 Or m > 0 Then MsgBox k & " substitutions made" & vbCr & _ m & " substitutions skipped", vbInformation Exit Sub End Sub




Reply With Quote