A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Text in brackets to multi line text with styles



 
 
Thread Tools Display Modes
  #1  
Old June 23rd 12, 04:12 AM
ddurgaprasa ddurgaprasa is offline
Junior Member
 
First recorded activity by WordBanter: Jun 2012
Posts: 0
Default Text in brackets to multi line text with styles

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
Ads
  #2  
Old June 24th 12, 03:42 AM
ddurgaprasa ddurgaprasa is offline
Junior Member
 
First recorded activity by WordBanter: Jun 2012
Posts: 0
Default

Quote:
Originally Posted by ddurgaprasa View Post
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 the result.I used below functions after following instructions in 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^lICD 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 Sub
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
here's a word macro to fix wrap multi-line text when pasting josh[_2_] Page Layout 2 June 16th 09 10:21 AM
Memo fields (multi line text) and Microsoft Word 2002 - text datasource newschapmj1[_2_] Mailmerge 3 May 21st 08 12:55 PM
replacing text with open/closing text marks or brackets GottaRun Microsoft Word Help 1 December 6th 07 06:16 AM
Different text Styles on the same line Dodane New Users 1 July 17th 07 10:29 PM
how to get multi-line text item to insert off a pick list on a form. LFM Microsoft Word Help 2 June 10th 07 01:27 AM


All times are GMT +1. The time now is 05:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004-2013 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.