Forum Discussion

Whit1984's avatar
Whit1984
Copper Contributor
Jun 04, 2022

Identifying random symbol in word to create a find/replace macro

 



The two dashes after "so" are what are supposed to be there (I added after copy/paste from another program) but when I paste from the other software (CAT software for court reporting) it gives me the two blocks at the end instead. How can I figure out which symbol this is and write a find/replace macro for it? It's just started doing this in the last few months, and I had Microsoft support look at it, and while it looked fixed for a moment, then all of a sudden it wasn't fixed.

I thought it may also be in my macro that I run to remove punctuation after the double dash in my CAT software. (I'm pasting the whole macro though it does not all apply to the things at issue here.)  However, in digging a little further, it's happening when I copy/paste from the other program and there are only the two dashes at the end and not the ones with punctuation after them that I run the macro to clear.  (I paste -- and not --. or --? which are then cleared by the macro as I want the end result to have no punctuation after the dashes.)

Could anyone please help?


Sub ProCATedit()
'
' ProCATedit Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "--?"
.Replacement.Text = "--"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "--."
.Replacement.Text = "--"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " ^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Okay?"
.Replacement.Text = "Okay."
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ": "
.Replacement.Text = ": "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

  • If you select one of the blocks and then in the immediate window of the VBE, type

    MsgBox Asc(Selection)

    what is returned.