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
Need to an alternate method for search/replace with a loop line by line(?)
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.