![]() |
| 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. |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
Quote:
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 | |
|
|
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 |