![]() |
#1
|
|||
|
|||
![]()
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 |
Tags |
insert comment, vba macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
shilabrow | Excel Programming | 4 | 06-23-2014 08:16 AM |
Macro to insert Text | Morte | Excel Programming | 1 | 03-04-2014 04:33 PM |
![]() |
Sharon | Word | 5 | 01-29-2013 03:12 AM |
Macro to insert new page... | samanthaj | Word | 17 | 01-31-2012 01:53 PM |
![]() |
rfhall50 | Word VBA | 2 | 10-25-2010 12:41 PM |