ddurgaprasa;492678 said:
I have thousands of entires with text like below
1)xyz records shall [040402010103::ICD BIN FILE PRIM 05::SI_TcSE_74654
have number of elements
Is there a way to format this text as below
1) xyz records shall have number of elements
Anchor: 040402010103
ICD Anchors: [ICD BIN FILE PRIM 05::SI_TcSE_74654]
Derived: No
Comments: None
I am newbie to word macros.Did a little search in the forum and got th
result.I used below functions after following instructions i
http://word.mvps.org/FAQs/General/UsingWildcards.htm
Sub FindReplaceShallTag_StepOne()
With ActiveDocument.Content.Find
.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
With .Replacement
.ClearFormatting
With .Font
.Bold = False
.Italic = False
.Size = 11
End With
End With
.Execute Forward:=True, Replace:=wdReplaceAll, _
FindText:="(\[*\]) ([a-zA-Z ]{2,}?)", ReplaceWith:="\2\1"
End With
FindReplaceShallTag_StepTwo
FindReplaceShallTag_StepThree
End Sub
Sub FindReplaceShallTag_StepTwo()
With ActiveDocument.Content.Find
.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
With .Replacement
.ClearFormatting
With .Font
.Bold = False
.Italic = False
.Size = 11
End With
End With
.Execute Forward:=True, Replace:=wdReplaceAll, _
FindText:="\[(*):
*)\]", ReplaceWith:="^lAnchor:\1^lIC
Anchor:[\2]^lDerived: ^lComments:"
End With
End Sub
Sub FindReplaceShallTag_StepThree()
With ActiveDocument.Content.Find
.ClearFormatting
With .Font
.Size = 11
End With
.Format = True
With .Replacement
.ClearFormatting
With .Font
.Bold = True
.Italic = False
.Size = 11
End With
End With
.Execute Forward:=True, Replace:=wdReplaceAll, _
FindText:="Anchor:", ReplaceWith:="Anchor:"
.Execute Forward:=True, Replace:=wdReplaceAll, _
FindText:="ICD Anchor:", ReplaceWith:="ICD Anchor:"
.Execute Forward:=True, Replace:=wdReplaceAll, _
FindText:="Derived:", ReplaceWith:="Derived:"
.Execute Forward:=True, Replace:=wdReplaceAll, _
FindText:="Comments:", ReplaceWith:="Comments:"
End With
End Su