Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-10-2014, 04:10 PM
rsrasc rsrasc is offline Need Short Macro-Find and Replace Windows 7 64bit Need Short Macro-Find and Replace Office 2010 64bit
Competent Performer
Need Short Macro-Find and Replace
 
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
  #2  
Old 11-10-2014, 04:26 PM
macropod's Avatar
macropod macropod is offline Need Short Macro-Find and Replace Windows 7 64bit Need Short Macro-Find and Replace Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Code:
Sub AnswerLetterChange()
With ActiveDocument.Content.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .Wrap = wdFindContinue
  .Format = False
  .MatchWildcards = True
  .Text = "<([A-D]):"
  .Replacement.Text = "\1."
  .Execute Replace:=wdReplaceAll
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-10-2014, 05:03 PM
rsrasc rsrasc is offline Need Short Macro-Find and Replace Windows 7 64bit Need Short Macro-Find and Replace Office 2010 64bit
Competent Performer
Need Short Macro-Find and Replace
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default

Thanks! Working great!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Short Macro-Find and Replace Find and Replace Macro amparete13 PowerPoint 3 03-11-2014 05:29 AM
Need Short Macro-Find and Replace Is the following too complex for find/replace macro? bertietheblue Word VBA 12 11-04-2013 05:35 PM
Find - Replace Macro using a table list mdw Word 0 08-01-2013 04:36 PM
macro or find/replace JamesVenhaus Word 2 02-27-2012 03:34 PM
Find and Replace Macro - A Better Way Tribos Word VBA 0 10-08-2008 03:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft