Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-03-2015, 05:42 AM
AlexandarR AlexandarR is offline How to insert comments thro' macro Windows XP How to insert comments thro' macro Office 2003
Novice
How to insert comments thro' macro
 
Join Date: Mar 2015
Location: Chennai, Tamilnadu, India
Posts: 7
AlexandarR is on a distinguished road
Thumbs up 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


Reply With Quote
 

Tags
insert comment, vba macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert comments thro' macro How to Insert more criteria in Macro shilabrow Excel Programming 4 06-23-2014 08:16 AM
Macro to insert Text Morte Excel Programming 1 03-04-2014 04:33 PM
How to insert comments thro' macro Macro to insert picture in footer Sharon Word 5 01-29-2013 03:12 AM
Macro to insert new page... samanthaj Word 17 01-31-2012 01:53 PM
How to insert comments thro' macro Macro for Picture Insert rfhall50 Word VBA 2 10-25-2010 12:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:22 PM.


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