![]() |
|
|
|
#1
|
||||
|
||||
|
Hi redzan,
Try: Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Content
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "STUDY: ([!^13]{1,})*: ([!^13]{1,})*: ([!^13]{1,})*: ([!^13]{1,})*: ([!^13]{1,})*: ([!^13]{1,})"
.Replacement.Text = "###\1,\2,\3,\4,\5,\6"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
.Text = "(###[!^13 ]{1,})[ ]{1,}(*^13)"
.Replacement.Text = "\1\2"
.Execute Replace:=wdReplaceAll
.Execute
End With
Do While .Find.Found
.Text = Replace(.Duplicate.Text, " ", "")
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
You are a genius! It works just exactly like I need it to. I really appreciate your help on this. This will save me a ton of time.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I assign a macro to a button when the macro is in my personal workbook? | foolios | Excel Programming | 2 | 07-27-2011 02:41 PM |