![]() |
#1
|
|||
|
|||
![]()
My data is 1-3 lines unique code that is first element in data segment. May Not be new paragraph. First field is 1-5 digits comma and then 1 digit and comma
Original File Line 1 123,2,text1, text2,.... Line 2 ....text 10 Line 3 145,3,text1....text 5 Line 4 156, 2, text 1...text5 Line 5 ......................text10 Line 6 ......................text15 ........... Line 7000 4160,3,text1......text4 Desired Output - Search for ([0-9],[0-9]) and insert (001) before search term and (002) before next search term Output File Line 1 (001) 123,2,text1, text2,.... Line 2 ....text 10 Line 3 (002) 145,3,text1....text 5 Line 4 (003) 156, 2, text 1...text5 Line 5 ......................text10 Line 6 ......................text15 Line 7 (004) 160,3,text1......text4 Maybe 1000 pages I used https://www.msofficeforums.com/word-...ight-text.html as template and have just seach working. Code:
Sub Wildcard_Search_Insert_Nums() Application.ScreenUpdating = False Options.DefaultHighlightColorIndex = wdYellow With ActiveDocument.Content.Find .ClearFormatting .Text = "([0-9],[0-9])" With .Replacement .Text = "TEST^&XXX" .ClearFormatting .Highlight = True End With .Forward = True .Wrap = wdFindContinue .Format = True .MatchWildcards = True .Execute Replace:=wdReplaceAll End With Application.ScreenUpdating = True End Sub with n=n+1 inside loop? Really frustrated. Would appreciate any help. Obviously can use C program to do this but want functionality for all users, not 3 machines out of hundreds that have compilers. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issue with wildcard search | mysterytramp | Word | 0 | 05-13-2015 10:40 AM |
search and replace a field containing text and numbers | H28Sailor | Word | 6 | 09-11-2014 01:00 AM |
Issue with Wildcard Search and Replace | linusthedog | Word | 3 | 09-04-2014 03:32 PM |
Where is the error in my wildcard search? | Ulodesk | Word | 10 | 06-30-2014 01:46 PM |
Wildcard search help. | Kempston | Word | 0 | 11-13-2009 03:58 AM |