View Single Post
 
Old 11-10-2014, 04:10 PM
rsrasc rsrasc is offline Windows 7 64bit Office 2010 64bit
Competent Performer
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Need Short Macro-Find and Replace

Can the below code be summarized with a short code?

Thanks!

PHP Code:
Sub AnswerLetterChange()
'
AnswerLetterChange Macro
'
'
    
Selection.Find.ClearFormatting
    Selection
.Find.Replacement.ClearFormatting
    With Selection
.Find
        
.Text "A:"
        
.Replacement.Text "A."
        
.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 "B:"
        
.Replacement.Text "B."
        
.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 "C:"
        
.Replacement.Text "C."
        
.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 "D:"
        
.Replacement.Text "D."
        
.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 
Reply With Quote