![]() |
#4
|
||||
|
||||
![]()
Try the following Word macro:
Code:
Sub Demo() Application.ScreenUpdating = False Dim StrFnd As String, i As Long StrFnd = "at_case_id,ca_case_ref,at_created_dt,at_audit_type,at_audit_note,at_user_id" With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Format = False .Forward = True .Wrap = wdFindContinue .MatchWildcards = True .Text = "^13([a-z]{2}[!_])" .Replacement.Text = "\1" .Execute Replace:=wdReplaceAll .Text = "^13{2,}" .Replacement.Text = "^p" .Execute Replace:=wdReplaceAll .Text = Split(StrFnd, ",")(0) & " " .Replacement.Text = "" .Execute Replace:=wdReplaceAll For i = 1 To UBound(Split(StrFnd, ",")) .Text = "^13" & Split(StrFnd, ",")(i) & " " .Replacement.Text = "," .Execute Replace:=wdReplaceAll Next End With .InsertBefore StrFnd & vbCr End With Application.ScreenUpdating = True End Sub For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm. For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rsrasc | Word VBA | 3 | 11-11-2014 03:55 PM |
![]() |
rsrasc | Word VBA | 2 | 11-11-2014 09:46 AM |
![]() |
rsrasc | Word VBA | 4 | 11-11-2014 08:28 AM |
Advanced search and replace for bullet points | TishyMouse | Word | 5 | 02-17-2012 06:32 AM |
![]() |
anno1404 | Word | 1 | 10-21-2010 03:58 AM |