How to insert comments thro' macro
Hi!
I want to find "UK" or "U.K." within selection <AFF>...</AFF>, and replace it to "United Kingdom". More than that, I want to insert a comment "Country name changed. Please check" only if replacement done.
<AFF>Department of Physics and Astronomy and National Center for Physical Acoustics, University of Mississippi, P.O. Box 1848, 1 Chucky Mullins Drive, University, Mississippi 38677</AFF>
I have recorded a macro, except inserting comment.
Please help. Thanks in advance.
CODE:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/3/2015 by alexandarr
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "\<AFF\>*\<\/AFF\>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Copy
Documents.Add DocumentType:=wdNewBlankDocument
Application.Run MacroName:="MathTypeCommands.UIWrappers2003.EditPa ste"
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "UK"
.Replacement.Text = "United Kingdom"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "U.K."
.Replacement.Text = "United Kingdom"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Copy
Windows("AI-JAS#150100_ed.doc").Activate
Application.Run MacroName:="MathTypeCommands.UIWrappers2003.EditPa ste"
End Sub
|