Text in brackets to multi line text with styles

D

ddurgaprasa

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: Non
 
D

ddurgaprasa

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top